用dojo绘制的线在IE8中不显示

发布于 2024-12-27 01:18:20 字数 878 浏览 1 评论 0原文

我正在使用 dojo 1.6,发现在 IE8 中用曲面绘制线条有一个奇怪的行为。在某些情况下,这条线会消失。 这是我使用的示例代码(忽略某些内容):

var surface = dojox.gfx.createSurface("test", 500, 400);
var path = " M235 216 L240.5 216 M240.5 216 S244.5 216 244.6 212 M244.6 212 " +
           "L244.5 124 M244.5  124 S244.5 120 248.5 120.1 M248.5 120.1 L249 120";
var stroke = { color: "#63E4FF", width: 3};
surface.createPath(path).setStroke(stroke)

使用这样的路径和笔画,线条无法显示。 但是,如果我对路径或笔画变量进行了一些更改,则该线显示得很好。请参见以下内容:

  1. 将storke变量中的宽度修改为1
  2. 或将path变量中最后一个“L249 120”修改为“L249.5 120”(更改x),但249-249.4不起作用
  3. 或修改最后一个“L249 120” ” 到“L249 120.5”(更改 y)路径变量,但 120.1 - 120.4不起作用

如果你想尝试一下,请使用上面的路径并在dojo-release-1.6.1-src\dojox\gfx\tests\test_setPath.html中描边。 (下载dojo sdk文件)。

我不确定这是一个错误还是我做错了什么。 有人可以给我一些关于如何避免此类问题的建议吗? 多谢。

I am using dojo 1.6 and find a strange behavior for painting line with surface in IE8. The line just disappears in some situations.
Here are the sample codes (ignore something) I used:

var surface = dojox.gfx.createSurface("test", 500, 400);
var path = " M235 216 L240.5 216 M240.5 216 S244.5 216 244.6 212 M244.6 212 " +
           "L244.5 124 M244.5  124 S244.5 120 248.5 120.1 M248.5 120.1 L249 120";
var stroke = { color: "#63E4FF", width: 3};
surface.createPath(path).setStroke(stroke)

With such path and stroke, the line cannot display.
But if I made several changes for path or stroke variable, the line shows well. Pls see the following:

  1. Modify width to 1 in storke variable
  2. or modify the last "L249 120" to "L249.5 120" (change x) in path variable, but 249-249.4 doesn't work
  3. or modify the last "L249 120" to "L249 120.5" (change y) in path variable, but 120.1 - 120.4 doesn't work

If you'd like to have a try, pls use the above path and stroke in dojo-release-1.6.1-src\dojox\gfx\tests\test_setPath.html. (download dojo sdk files).

I'm not sure this is a bug or I make something wrong.
Could anyone give me some advice on how to avoid such an issue?
thanks a lot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

你的他你的她 2025-01-03 01:18:20

IE/VML 不支持小数坐标——它们通常是四舍五入的。这就解释了你的#2 和#3。这种到整数的转换发生在应用任何转换之前,因此无法通过放大来修复。

至于消失的线条 --- 我以前见过这个问题,而且我认为它不会很快或永远得到解决 --- VML 很久以前就被 MS 屏蔽了。尝试调整坐标,例如,将它们乘以 1.5、2、10 或其他数字,然后使用变换将其缩放回适当的大小 --- 这对我很有帮助。

IE/VML doesn't support fractional coordinates --- they are usually rounded off. That explains your #2 and #3. This conversion to integers happens before any transformation is applied, so it cannot be fixed with magnification.

As to vanishing lines --- I saw this problem before, and I don't think it'll be fixed any time soon or ever --- VML is canned by MS long time ago. Try to tweak coordinates, e.g., multiply them by 1.5, 2, 10, or some other number, and use a transformation to scale it back to a proper size --- it helped me.

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