Openseadragon: print selected zone

Created on 21 Dec 2017  Â·  3Comments  Â·  Source: openseadragon/openseadragon

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

  • for have these two choices,
  • for print a selected zone, please?

Thanks in advance and merry Christmas :)

question

All 3 comments

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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CodeBennn picture CodeBennn  Â·  4Comments

htmllancer picture htmllancer  Â·  5Comments

darwinjob picture darwinjob  Â·  3Comments

Ronsho picture Ronsho  Â·  3Comments

mnyrop picture mnyrop  Â·  3Comments