I am using Openseadragon to view a image of size 15000, 10000. My view size is 800, 600.
I want to draw a rectangle at location 1500, 1200.
I am converting my pixel co-ordinates to view port coordinates using API - imageToViewportRectangle.
But it doesn't work. I tried normalizing my pixel coordinates by deriving factor of 800/15000 and 600/10000 as well. I multiply this factor to 1500, 1200 and pass those to API.
None of the approach works and it returns the same values all the time.
Please suggest if I am missing something.
Thanks & Regards
Sumit
I found the answer the hard way ... the API works (without any normalization) but only when I use it from a button click!
i think I was trying to create the shapes before the viewport is completely getting loaded. Now I am looking for event which will tell me if the viewer and viewport are ready for a conversion.
Should we keep the issue open till we get that answer ? Not sure ...
Listening to the open event should be enough.
If not, you can use the new fully-loaded-change event added in #837 but it is only available on the master branch at the moment.
Thanks for the answer....
Most helpful comment
Listening to the
openevent should be enough.If not, you can use the new
fully-loaded-changeevent added in #837 but it is only available on the master branch at the moment.