旋转Openseadragon图像时,Fabric Canvas更改位置 [英] Fabric Canvas changing position when Openseadragon image is rotated

查看:630
本文介绍了旋转Openseadragon图像时,Fabric Canvas更改位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在OpenSeadragon(osd)上使用Fabric.js Canvas。我试图在osd图像上创建一个指南针/旋转器小部件,它将旋转osd图像。它应该使用osd图像进行缩放和平移,但不应该使用osd图像进行旋转。


当我使用时,事情变得越来越整洁


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旋转,但Fabric画布对象的位置也会随之改变,即使我有将对象设置为图像的中心。这是 codePen链接

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

推荐答案

问题是我要使用viewer.setRotation()来旋转查看器对象。

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

Line number - 75 - 我将代码更改为

Line number - 75 - I changed the code to

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


问题已解决。上面的codePen已更新。


and the issue was fixed. Above codePen is updated.

这篇关于旋转Openseadragon图像时,Fabric Canvas更改位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆