Excanvas vml positioning issue

2019-04-12 20:35发布

I've slogged my way through implementing excanvas on ie8. I've got the dynamic element bit sorted, the initially-hidden elements are now happily rendering throughout most of the app, and just when all seemed to be well I've hit another roadblock. The vml items rendered inside the div that excanvas generates are all offset by a large amount.

I only discovered what was happening by setting overflow:visible on all children of canvas, which caused the offset vml to become visible.
I've got a screenshot of the offending articles; the area in blue is the generated div in the correct position, and the items bordered in red should be within the blue area.

enter image description here

Has anyone encountered this before, and even better, been able to solve it?

Cheers!

1条回答
smile是对你的礼貌
2楼-- · 2019-04-12 21:00

In case anyone ever encounters this error, it seems the issue was with a translate() call. Although I was using save and restore, and every standard implementation of canvas interpreted the translate call as I intended, in excanvas the translate was persistently additive.

I solved the issue by restoring the identity matrix before performing the other save, translate & restore calls.

context.setTransform(1,0,0,1,0,0);
查看更多
登录 后发表回答