These are chat archives for openseadragon/openseadragon

2nd
Apr 2017
Antoine Vandecreme
@avandecreme
Apr 02 2017 16:27
In that case you can just add the images to the viewer: http://openseadragon.github.io/examples/multi-image/
You will probably need to build a pyramid of each image for performance reason though (or use on the fly pyramids as suggested above)
Illya Moskvin
@IllyaMoskvin
Apr 02 2017 16:39

I'm a bit stuck trying to figure out how to differentiate between tap/click and drag events. I'd like to not trigger the releaseHandler if dragging has occurred.

For context, I have an instance of svg-overlay with hotspots. My current solution allows me to catch click events on the hotspots (via clickHandler, but I suspect that will have to change into a releaseHandler) and pass drag events to the viewer below.

Unfortunately, that results in the clickHandlertriggering if the user taps/clicks down on the hotspot, drags it elsewhere (thus moving the canvas), and releases on the hotspot, once it moves under their finger again.

I'd like to add some sort of check to test if a drag happened... is there anything like that built into OpenSeadragon?

new OpenSeadragon.MouseTracker({
    element: rect[0][0], // Hotspot element
    clickHandler: function(event) {
        // Open the item
    },
    dragHandler: viewer.innerTracker.dragHandler
}).setTracking(true);
Illya Moskvin
@IllyaMoskvin
Apr 02 2017 16:47
This is the solution I'm using currently. Is there a better way to do it?
var dragged = false;
new OpenSeadragon.MouseTracker({
    element: rect[0][0], // Hotspot element
    clickHandler: function(event) {
        if( !dragged ) {
            callback( id );
        }
        dragged = false;
    },
    dragHandler: function(event) {
        dragged = true;
        viewer.innerTracker.dragHandler.apply( this, arguments );
    },
}).setTracking(true);
Illya Moskvin
@IllyaMoskvin
Apr 02 2017 18:21
Hmm looks like viewer.viewport.applyConstraints() also needs to be called in a releaseHandler, otherwise the user can drag the image out of bounds by grabbing it by one of the hotspots.
Lucian Apetrei
@Lucian_Apetrei_twitter
Apr 02 2017 18:44
@avandecreme Very cool, but how will this work on mobile? I mean, how much does the pyramid help and what server side library do you recommend for this?