2


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

Neeraj Kumar
  • 226
  • 4
  • 18
  • Fabric canvas has correct position, and shapes are staying on the same position as you specified. You will not have any problem if your image will be as a square. It can be done for rectangular image, but you shouldn't rotate image with mouse, it should be dynamic update. Give more details what king of images you will have and how rotation will happen (with cursor as you created or dynamically) – Observer Aug 02 '17 at 13:54

1 Answers1

3

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.

Neeraj Kumar
  • 226
  • 4
  • 18