Hello,
Web development beginner, I'm trying to optimize an existing code using openseadragon and jQuery to zoom or print selected picture after a dialogbox.
I can select a picture part then zoom it:
var zoomSelection = viewer.selection({
prefixUrl: webroot + 'openseadragon/selection/images/',
onSelection: function(rect) {
// Zoom selection
var zoomArea = viewer.viewport.imageToViewportRectangle(rect);
viewer.viewport.fitBoundsWithConstraints(zoomArea, true);
}
});
Then, I tried to select a picture part then print it:
var printSelection = viewer.selection({
prefixUrl: webroot + 'openseadragon/selection/images/',
onSelection: function(rect) {
dialog.dialog('open');
}
});
But in this case, the selected zone is zoomed...
var call are below:
$('#zoom-selection').on('click', function() {
$(this).toggleClass('sel');
zoomSelection.toggleState();
});
$('#print-selection').on('click', function() {
$(this).toggleClass('sel');
printSelection.toggleState();
});
I found that if I comment zoomSelection, of course selected zone is not zoomed but I'm wondering how to do
Thanks in advance and merry Christmas :)
Sounds like this is a question about https://github.com/picturae/openseadragonselection not OSD directly. Anyway, I think you should make just one selection and in your onSelection choose to zoom or print based on a flag you set in your click handlers.
Thanks, I will try to go this way
All is great, thanks again :)