These are chat archives for openseadragon/openseadragon

17th
Jul 2017
Ian Gilman
@iangilman
Jul 17 2017 16:35
@altert Thanks for the heads up! I'll take a look at the m2 demo
For your app it should be as simple as dropping a setTimeout(func, 1) around your handler code
Ian Gilman
@iangilman
Jul 17 2017 17:42
Btw, I've written up some more on the release: http://blog.iangilman.com/2017/07/openseadragon-230.html
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 17:59
Hi are there anyone?
need a help around Navigator
Ian Gilman
@iangilman
Jul 17 2017 17:59
Sure... what's up?
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:00
Im trying to create a Navigator in a separate container
it'll initialize sometime later
i mean after the viewer initialization
is it possible?
im currently trying creating a new OpenSeadragon.Navigator instance
passing the container id and viewer reference
but its not working
its rendering some elements
but nothing visible
Ian Gilman
@iangilman
Jul 17 2017 18:03
You just want the navigator for your viewer to be somewhere else on the page?
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:03
yeah
but I need to initialize it later
Ian Gilman
@iangilman
Jul 17 2017 18:04
You can't just let the viewer initialize it?
The easiest is the "custom navigator location" thing documented at the bottom of http://openseadragon.github.io/examples/ui-viewport-navigator/
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:04
No.. requirement doesn't let me to do so
;(
Ian Gilman
@iangilman
Jul 17 2017 18:05
Interesting... why not?
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:05
im doing something like this
user will able to toggle a panel containing the navigator
and the container will not available at the time i'm initializing the viewer
Ian Gilman
@iangilman
Jul 17 2017 18:06
Seems like you could still let the viewer manage it, but control its visibility with CSS on the containing element
I see
Well, we don't have direct support for this scenario, but you can look at how the viewer manages its navigator and basically copy that code out into your own project
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:07
if the viewer it self can create a instance with new $.Navigator, why can't we
aah
yeah I took a look at it
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:07
but couldnt have a clue
hmm ok... i'll have a further look
anyway thanks a lot
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:09
OpenSeadragon is awesome
Ian Gilman
@iangilman
Jul 17 2017 18:10
Thank you! :)
It's a team effort here!
I think those are the key bits @ssrajapaksha_twitter
Sriyan Sampath
@ssrajapaksha_twitter
Jul 17 2017 18:16
Thanks
Alexey Tikhonov
@altert
Jul 17 2017 19:53
@iangilman I'm sorry, could you explain the timeout solution if possible? You mean I should delay starting fitbounds by sone specific time?
Ian Gilman
@iangilman
Jul 17 2017 20:04
@altert I'm just saying you need to modify your event code like so:
// Before
viewer.addHandler('canvas-click', myHandler);

// After
viewer.addHandler('canvas-click', function(event) {
  setTimeout(function() {
    myHandler(event);
  }, 1);
});
Apologies for the extra work... on balance I think the change is worthwhile (see openseadragon/openseadragon#1148)
...and of course let me know if my suggestion isn't working!
Alexey Tikhonov
@altert
Jul 17 2017 20:17
Interesting! I'll try it and also try to get the reasoning)
Ian Gilman
@iangilman
Jul 17 2017 20:19
:)
Actually, you might try using the new ability to cancel the canvas click if your plan is to override the behavior
Alexey Tikhonov
@altert
Jul 17 2017 20:28
Yeah, my code disabled normal zoom on click, so I guess that part should be changed
Ian Gilman
@iangilman
Jul 17 2017 20:29
Cool... so maybe you can take advantage of the intended purpose for that patch :)
Alexey Tikhonov
@altert
Jul 17 2017 20:31
I guess;)
Alexey Tikhonov
@altert
Jul 17 2017 20:39
Solution worked perfectly) thanks
Ian Gilman
@iangilman
Jul 17 2017 20:51
@altert Excellent! With preventDefaultAction or setTimeout (you probably don't need both)?
Alexey Tikhonov
@altert
Jul 17 2017 20:52
I've tried settimeout first)
Ian Gilman
@iangilman
Jul 17 2017 20:53
Cool. Well, if you want to try preventDefaultAction, it's probably slightly more efficient
Matt D
@dephora
Jul 17 2017 22:58
I'm probably doing something stupid but in trying to drawn an overlay using a height and width of 1, 1 , my width is accurate but my height is getting my width value (and therefore not tall enough)
let digitalStainImage = document.createElement('img');
                digitalStainImage.id = 'digital-stain-overlay';
                digitalStainImage.src = get(this, 'digitalStainUrl');

                digitalStainOverlay = {
                    element: digitalStainImage,
                    // location: new OpenSeadragon.Rect(0, 0, 1, 1)
                    width: 1,
                    height: 1,
                };
I've tried it both with and without the location
Matt D
@dephora
Jul 17 2017 23:03
Suppose it would help to know what I'm trying to accomplish - the overlay needs to be 100% of the image in both directions.
Ian Gilman
@iangilman
Jul 17 2017 23:04
Ah so
Is your image square?
Matt D
@dephora
Jul 17 2017 23:04
its not, taller than it is wide
Ian Gilman
@iangilman
Jul 17 2017 23:05
Well that's your problem right there ;)
By default the image gets a width of 1 in viewport coordinates and a height of whatever is appropriate for its aspect ratio based on the width of 1
...so if the image is twice as tall as it is wide, then a width of 1 means a height of 2
Matt D
@dephora
Jul 17 2017 23:06
Ah gotcha, okay
Ian Gilman
@iangilman
Jul 17 2017 23:06
Of course you can just do viewer.world.getItemAt(0).getBounds() to find out your image's bounds (assuming it was just the one image)
All these coordinates can be confusing! :)
Matt D
@dephora
Jul 17 2017 23:07
Haha, yeah
Matt D
@dephora
Jul 17 2017 23:18
Appreciate it! Will give it a go
Matt D
@dephora
Jul 17 2017 23:32
Perfect, that worked out, thanks @iangilman !
Ian Gilman
@iangilman
Jul 17 2017 23:36
@dephora Excellent :)