Raphael 图形在 IE8 中不显示
现在,我无法在 extJS 面板中显示简单的 Raphael 图形。
afterRender: function(){
var size = Math.min(this.getHeight(), this.getWidth());
this.innerEl = this.el.createChild({
cls : 'ext-ux-clock-inner'
});
this.canvas = Raphael(this.innerEl.dom, size, size);
var circle = this.canvas.text(50, 40, 'test').attr( {
font : '14px Helvetica, Arial',
stroke : "none",
fill : '#fff'
});
TimelineWindowPanel.superclass.afterRender.apply(this,arguments);
}
该文本在 Firefox 和 Chrome 中显示良好,但我似乎无法在 IE8 中显示该文本。我尝试过使用未压缩版本和缩小版本,但没有成功。有谁知道为什么 Raphael 不能与 extJS 一起使用 IE8 吗?
编辑: 如果我将 IE8 更改为兼容模式,它会显示 Raphael 图形
Right now I'm having trouble getting a simple Raphael graphic to show in a extJS panel.
afterRender: function(){
var size = Math.min(this.getHeight(), this.getWidth());
this.innerEl = this.el.createChild({
cls : 'ext-ux-clock-inner'
});
this.canvas = Raphael(this.innerEl.dom, size, size);
var circle = this.canvas.text(50, 40, 'test').attr( {
font : '14px Helvetica, Arial',
stroke : "none",
fill : '#fff'
});
TimelineWindowPanel.superclass.afterRender.apply(this,arguments);
}
The text shows up fine in Firefox and Chrome, however I can't seem to get this text to display in IE8. I've tried using the uncompressed version along with the minified version with no luck. Does anybody know why Raphael doesn't work with IE8 with extJS?
Edit:
If I change IE8 into the compatibility mode it shows the Raphael graphic
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了 IE8 的解决方法。看起来 IE8 会在 ExtJS 窗口出现在屏幕上之前尝试在画布上绘制。我猜测发生的情况是 IE8 尝试在画布上绘制并失败,并且不会尝试重绘。所以拉斐尔的形象永远不会出现在画布上。我通过使用 javascript 函数
setInterval()
将绘制延迟 0.3 秒来解决这个问题I found a work around for IE8. It seems that IE8 attempts to draw onto the canvas before the ExtJS window appears on the screen. I'm guessing what's happening is that IE8 attempts to draw onto the canvas and fails and doesn't try to redraw. So the Raphael image never appears in the canvas. I was able to solve this by delaying the draw by .3 seconds using the javascript function
setInterval()