Raphael 图形在 IE8 中不显示

发布于 2024-10-09 02:04:40 字数 755 浏览 6 评论 0原文

现在,我无法在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

長街聽風 2024-10-16 02:04:40

我找到了 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()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文