question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maintain overlay sizes on screen while OSD zooming

See original GitHub issue

Hi, any idea how to maintain an object sizes on screen ( width & height ) for OSD overlay object while OSD is zooming in/out. For my case i am trying to keep Fabric JS object sizes on screen for the overlay.

What i have done is calculate a ratio of current OSD zoom level divided by the zoom level for 1:1 of image:viewport. And the result of those ratio used as denominator of a number that i just define, for example 500 or something. Here is the sample of code how i get the ratio for denominator:

self.zoomRatio = event.eventSource.viewport.getZoom() / self.viewer.viewport.imageToViewportZoom(1);

Thos zoomRatio i use as denominator for the sizes to produce new sizes of width & height.

As the result which is not really work well, i have a live demo at : http://biqdev.com/demo/bfabric-polygon/ , there is a red rectangle which i hope it will maintain the width & height on the screen while OSD zoom in/out.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bayucandracommented, Nov 4, 2016

You are right, actually i was put that way in my last option. However, since seem i can’t get more idea it is now my only option 😃. Thanks a lot for your response.

0reactions
iangilmancommented, Nov 8, 2016

Do you just want the events to pass through? If so, use pointer-events: none on the elements above.

Otherwise, if you want to catch them sometimes or process them somehow, how are you catching them? Have you tried using MouseTracker? Are you making sure that you are catching them?

As for triggering a click on the OSD, I’m not sure what the best way would be. You might experiment with events like mousedown and mousemove. You also might need to construct your event properly. You could also try fiddling with the viewer’s MouseTracker. You can also take a look at how we simulate clicks for our tests:

https://github.com/openseadragon/openseadragon/blob/master/test/helpers/test.js#L8

Read more comments on GitHub >

github_iconTop Results From Across the Web

openseadragon/openseadragon - Gitter
The beauty of OSD is that it never makes a canvas other then it designated size, zooming just loads diffferent resources. OSD in...
Read more >
How to set the initial zoom/width for a webview - Stack Overflow
I also experimented with setInitialScale but on different screen sizes and web page sizes that won't be as graceful as the browsers scaling....
Read more >
How to Set Up MSI Afterburner to Display Stats While Gaming ...
Now, locate the On-screen display zoom option in the app window. Drag the slider to the right to increase the size of the...
Read more >
Keep Text size the same position and size on screen while ...
How would I make a text box with stats with something like "score: " while keeping the text still while zooming in and...
Read more >
Class: Viewer - OpenSeadragon
The overlays added via this method are removed when the viewport is closed which include when ... Force the viewer to reset its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found