annotorious-openseadragon icon indicating copy to clipboard operation
annotorious-openseadragon copied to clipboard

Annotation selection not working when setting the hotkey as inverted

Open anderson-souza opened this issue 3 years ago • 2 comments

Hello guys, (sorry in advance for my English)

I think I found an issue when using the plugin along with the hotkey config, setting the inverted value as true. I have provided below a simple code that can replicate the behavior.

When I set the inverted property as true, I'm no longer able to select directly the annotation, only while holding the hotkey button I'm able to select it. The documentation says "Image navigation is only possible when the hotkey is pressed", which is exactly what I want, but I also wanted to select the annotation just by clicking on it, without holding the hotkey.

Setting the inverted as false, I can select directly the annotation to Edit/Delete without any problems.

Is this the correct behavior when using the inverted key? Is it possible to have the inverted as true and being able to select the annotation only by clicking?

I tested with the latest release version (2.7.8) in Mozilla Firefox 106.0.5

Thanks!!

<!DOCTYPE html>
<html>
  <head>
    <title>SeaDragon hotkey</title>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/openseadragon/3.1.0/openseadragon.min.js"></script>

    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/@recogito/[email protected]/dist/annotorious.min.css"
    />

    <script src="https://cdn.jsdelivr.net/npm/@recogito/[email protected]/dist/openseadragon-annotorious.min.js"></script>
    <script>
      window.onload = function () {
        var viewer = OpenSeadragon({
          id: "openSeaDragon",
          prefixUrl: "openseadragon/images/",
          tileSources: {
            type: "image",
            url: "https://images.pexels.com/photos/1054666/pexels-photo-1054666.jpeg?cs=srgb&dl=pexels-harvey-sapir-1054666.jpg&fm=jpg",
          },
        });

        var config = {
          hotkey: {
            key: "Shift",
            inverted: true,
          },
        };
        var anno = OpenSeadragon.Annotorious(viewer, config);
      };
    </script>
  </head>
  <body>
    <div id="openSeaDragon" style="height: 800px; width: 1200px"></div>
  </body>
</html>

anderson-souza avatar Nov 15 '22 03:11 anderson-souza

Thanks, I can reproduce. Hm, yes that's currently the way it works. (Just like a click on an annotation does not select it when you are not using inverted hotkeys, and have Shift pressed.) But I agree a click should trigger selection in any case. I need to check how to best implement this. I'll put it on the list!

rsimon avatar Feb 21 '23 20:02 rsimon

Just to add, with OpenSeadragon v4.1 headless mode with inverted key is true, the creation of the annotation only happens on first load. After creating one annotation, you cannot create annotation anymore. You can check it here: https://jsfiddle.net/riichan/j3Lvq92h/12/ Hopefully, it gets fixed after the release of Annotorious v3.

andrheapaltao avatar Jul 31 '23 06:07 andrheapaltao