Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SeaDragon Mouse Clicks

Tags:

seadragon

How can I determine the location of a mouse click on an Ajax SeaDragon scene relative to the source image that was used to generate the DeepZoom content?

like image 923
Allain Lalonde Avatar asked Oct 08 '10 16:10

Allain Lalonde


1 Answers

Here's how to get your position on the scene in pixels or seadragon coordinates :

obj = new Seadragon.Viewer( targetId )
obj.viewer.tracker.pressHandler = function(tracker, position) {   
        console.log('pressHandler', position.x, position.y);
        obj.location = new Seadragon.Point(
                parseInt(position.x),
                parseInt(position.y)
        );  
       var pointPos = obj.view.viewport.pointFromPixel(obj.location);
};

hope this helps

like image 115
jujule Avatar answered Sep 24 '22 15:09

jujule