Cursor tool not changing to default

WebViewer Version: 8.4
I have a custom tool with a custom cursor. When I press escape to change to default cursor, it does not change it outside the viewer. I have also tried setting the toolMode to 0 on escape but to no avail. Is there a way to change the cursor outside the viewer to default?

image

Hello,

Thank you for contacting WebViewer support.

Could you please share the code you’re using to create this custom tool?
If you also have a runnable project that you can share with us, it would be great and we can help you better on this.
If you want you can send it to dnavarro@pdftron.com.

Best,
Dandara Navarro
Web Software Developer
PDFTron Systems, Inc.

Shared to you a snippet for the custom tool. Thank you for helping!

I would like to follow-up on this issue @dnavarro thanks

Hello,

My sincere apologies for the late response.

I’d like to understand better the expected scenario for your use case.
When you say “press escape” do you mean the keyboard escape button and when pressing it has the cursor refresh? If so, where are you handling this on the code you sent me?

I saw you added the setToolMode to 0 on the mouseLeftDown function, did you try to use one of our tool names instead of zero? If not, could you please try and see if it works?

Your question is if there is a way to change the cursor to default when it is outside the viewer. You can listen to the events mouseLeave and mouseEnter and change the cursor according to these events. The following is an example of how you can make it.

documentViewer.addEventListener('mouseLeave', () => { 
    const currentTool = documentViewer.getToolMode();
    if (currentTool instanceof Tools.EthsignAnnotation) {
      currentTool.cursor = 'default';
    }
  });

  documentViewer.addEventListener('mouseEnter', () => { 
    const currentTool = documentViewer.getToolMode();
    if (currentTool instanceof Tools.EthsignAnnotation) {
      currentTool.cursor = 'pointer';
    }
  })

Please let us know if this works for you.

Best,
Dandara Navarro