These are chat archives for openseadragon/openseadragon

8th
Apr 2015
I switched to using the viewport x,y position, obtained from event.originalEvent.x and event.originalEvent.y
Jeremy Shipman
@jedateach
Apr 08 2015 21:12
hmm. not working on touch however. I’ll asume that sends a different kind of originalEvent object.
Jeremy Shipman
@jedateach
Apr 08 2015 21:30
@iangilman if I switch to using canvas-drag events on the viewer, I’m guessing I’ll need to make use of @msalsbery ’s OpenSeadragonViewerInputHook to prevent the default panning from occurring during a drag.
Ian Gilman
@iangilman
Apr 08 2015 21:32
Interesting...I'm not sure what event.originalEvent is; I would have assumed it was the browser native event, but not if it has .x and .y.
@jedateach you can set the viewer.panHorizontal and viewer.panVertical to false to disable the default panning
Jeremy Shipman
@jedateach
Apr 08 2015 21:35
right, good idea
Ian Gilman
@iangilman
Apr 08 2015 21:36
Hopefully we can get to the bottom of why the data is funky
...but trying canvas-drag may give us a clue
Jeremy Shipman
@jedateach
Apr 08 2015 21:40

FYI, I traced the issue right down through mouse tracker to a DOM element call. Here’s a stack trace:

$.extend.getElementOffset (openseadragon.js:1218)
getPointRelativeToAbsolute (mousetracker.js:1478)
updatePointersMove (mousetracker.js:3158)
handleMouseMove (mousetracker.js:1982)
onMouseMoveCaptured (mousetracker.js:1960)
THIS.(anonymous function).mousemovecaptured (mousetracker.js:216)

…where extend.getElementOffset just calls element.getBoundingClientRect…a DOM method.
I’m thinking that just suggests I might be looking in the wrong place…ie the bad data is set somewhere else.

Ian Gilman
@iangilman
Apr 08 2015 21:44
I wonder if it has to do with the existence of the overlay under your cursor...like maybe it's the overlay that's getting the event and since you're moving it or resizing it, it's a moving target?
Jeremy Shipman
@jedateach
Apr 08 2015 21:46
I think I follow…trying track the mouse on something which is being moved.
Ian Gilman
@iangilman
Apr 08 2015 21:49
Just a thought
Jeremy Shipman
@jedateach
Apr 08 2015 21:53
is there a quick/easy function for detecting if a position is inside a given rect?
Ian Gilman
@iangilman
Apr 08 2015 21:59
We don't have a rect.inside() function, though maybe we should
Ian Gilman
@iangilman
Apr 08 2015 22:34
@jedateach turns out I just had to write it for my own project:
inside: function(point, rect) {
      return (point.x >= rect.x && point.x < rect.x + rect.width && point.y >= rect.y && point.y < rect.y + rect.height);
    },
Jeremy Shipman
@jedateach
Apr 08 2015 22:37
nice, thanks. I think it'd definitely be a good addition to rectangle.js
Ian Gilman
@iangilman
Apr 08 2015 22:37
:+1:
Jeremy Shipman
@jedateach
Apr 08 2015 22:40
the new canvas-drag approach seems to be working.
I am getting a bug on touch where it will trigger a pan to the bottom/right during/after dragging the area selection box
I'm guessing there's some spring force or something along those lines that is being released
can I stop that on drag finish?
like set the momentum to 0
Ian Gilman
@iangilman
Apr 08 2015 22:46
Set gestureSettingsTouch.flickEnabled to false
...on viewer
Jeremy Shipman
@jedateach
Apr 08 2015 22:50
great, did the trick. thanks.
Ian Gilman
@iangilman
Apr 08 2015 22:53
:)
Jeremy Shipman
@jedateach
Apr 08 2015 22:53
not sure how easy this is to remedy...but on touch the box lags behind my finger a bit. I'm assuming this is because it is drawing all the previous overlay updates. Is there a way to kill those scheduled frames?
Ian Gilman
@iangilman
Apr 08 2015 22:57
I don't think that's how it works; It should draw whatever the current state is when it's time to draw a frame
Do you have it running somewhere I could take a look?
Jeremy Shipman
@jedateach
Apr 08 2015 22:59
1 sec, I'll just upload
Mark Salsbery
@msalsbery
Apr 08 2015 23:00
It should lag with flick turned off - the same way it does by default with the mouse
oh right! ...yes its matching the lag behaviour of the canvas panning
Mark Salsbery
@msalsbery
Apr 08 2015 23:02
For what it’s worth, my annotation framework (soon to be OpenSeadragonAnnoHost plugin) uses an element overplayed on the viewer. This element (the “host”) has the MouseTracker and marshals events - either to annotations if they want them, or up the tree. It’s also where bubbling is prevented when necessary. This makes it way easier instead of fighting either the viewer’s handling or the moving target issue.
Ian Gilman
@iangilman
Apr 08 2015 23:03
Well then there you go
The box dragging looks great. Looks like resizing isn't working yet?
Looks great on iPhone too
Jeremy Shipman
@jedateach
Apr 08 2015 23:06
@msalsbery that sounds like a good approach to keep things tidy. I assume you'd need to toggle / untoggle annotation mode? otherwise, how would you seamlessly switch between dragging an element and panning the view?
@iangilman I haven't started resizing yet
Ian Gilman
@iangilman
Apr 08 2015 23:06
Cool
Jeremy Shipman
@jedateach
Apr 08 2015 23:06
I wonder if this work should be split into multiple pieces: resizable , and draggable (like jqueryUI)
or I could just make parts toggleable
Mark Salsbery
@msalsbery
Apr 08 2015 23:07
Precisely! I do use an annotation mode :)
Jeremy Shipman
@jedateach
Apr 08 2015 23:07
Any idea how I can disable that lagging?
Mark Salsbery
@msalsbery
Apr 08 2015 23:07
Modify the spring
I forget what the appropriate value is…I think it’s in the code comments...
Jeremy Shipman
@jedateach
Apr 08 2015 23:10
@msalsbery - I've just realised that I'm not actually seeing that lag on desktop. Only on tablet.
I think its something to do with the tablet itself being less powerful
trying to keep up with frames or something
or maybe there is some different touch behaviour I'm not understanding
its a fairly modern device (samsung galaxy note 2014)
Jeremy Shipman
@jedateach
Apr 08 2015 23:18
tested on my wife's iPhone4s - seems to work well (very little lagging)
Mark Salsbery
@msalsbery
Apr 08 2015 23:19
Yep spring shouldn’t come into play.
Ian Gilman
@iangilman
Apr 08 2015 23:20
No lagging on my iPhone6...I doubt the code is different for running on a Galaxy, so it's probably the device speed
Jeremy Shipman
@jedateach
Apr 08 2015 23:20
Speaking of mobile devices, has there been any extensive device testing of openseadragon? Is there plans/room to make it perform even better?
Ian Gilman
@iangilman
Apr 08 2015 23:21
I'd say it's been pretty adhoc...I'm sure there's room for improvement
Mark Salsbery
@msalsbery
Apr 08 2015 23:24
From earlier discussion: the original event is the event from the platform. If you choose to use that you have to keep in mind it could be from one of three event models and handle the available properties accordingly.
…and there should be no x or y in there :)
Ian Gilman
@iangilman
Apr 08 2015 23:25
That's what I thought!
...thanks for the confirmation :)
Jeremy Shipman
@jedateach
Apr 08 2015 23:26
haha. yeah, once I realised that ...i figured it was better to switch to using the viewer's mousetracker and corresponding event.position
Mark Salsbery
@msalsbery
Apr 08 2015 23:28
Yeah :) The three models use the legacy position properties and that’s what we use so it’s not an issue for position, but the MouseTracker properties are “normalized” so we don’t have to deal with that as much as possible
Jeremy Shipman
@jedateach
Apr 08 2015 23:29
cool, thanks a lot for your help guys
Mark Salsbery
@msalsbery
Apr 08 2015 23:29
hmm, actually iOS touch model is different so yeah, the MouseTracker one is good!
Jeremy Shipman
@jedateach
Apr 08 2015 23:29
I'm just wondering how I should go about testing this stuff. I guess I'll need to dive into the OSD tests and see how they work.
Ian Gilman
@iangilman
Apr 08 2015 23:32
Testing the annotations?
And yes the OSD tests do have some click mocking