Change tool cursor when hovering over annotations

WebViewer Version: ^7.2.0

Hi,
Is it possible to change ENABLE_ANNOTATION_HOVER_CURSORS option only for a specifics tool? I would like to have different cursor behavior for Polygon tool(false), but the rest tools should have the same behavior(true).

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

One way you could accomplish this would be to change the value on the toolModeUpdated event. For example:

const { documentViewer, Tools } = instance.Core;

documentViewer.addEventListener('toolModeUpdated', (tool) => {
  if (tool instanceof Tools.PolygonCreateTool) {
    Tools.Tool.ENABLE_ANNOTATION_HOVER_CURSORS = false;
  } else {
    Tools.Tool.ENABLE_ANNOTATION_HOVER_CURSORS = true;
  }
});

For WebViewer 7.2 it’s just slightly different:

const { docViewer, Tools } = instance;

docViewer.on('toolModeUpdated', (tool) => {
  if (tool instanceof Tools.PolygonCreateTool) {
    Tools.Tool.ENABLE_ANNOTATION_HOVER_CURSORS = false;
  } else {
    Tools.Tool.ENABLE_ANNOTATION_HOVER_CURSORS = true;
  }
});
1 Like