Fabric Canvas changing position when Openseadragon image is rotated

六眼飞鱼酱① 提交于 2019-12-24 15:49:41

问题



I am using Fabric.js Canvas on top of OpenSeadragon(osd). I am trying to create a compass/rotater widget on top of the osd image, which will rotate the osd image. It should zoom and pan with the osd image, but should not rotate with the osd image.

Things are getting tidy when i use

viewer.viewport.setRotation(angle);    

Osd Image rotates, but the location of the Fabric canvas objects also change with it, even though i have set the objects to be in the center of the image. Here is the codePen link


回答1:


The issue was that I was tring to use viewer.setRotation(), which rotates the viewer object.

Line number - 75 - I changed the code to

 viewer.world.getItemAt(0).setRotation(angle, true);


and the issue was fixed. Above codePen is updated.



来源:https://stackoverflow.com/questions/45456171/fabric-canvas-changing-position-when-openseadragon-image-is-rotated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!