skip to Main Content

I had a feature which can get current pointer color like photoshop. I’ve used setMouseNavEnabled to disable drag, but it also can’t scroll.

Does any way can only disable the drag event? Or enable scroll when setMouseNavEnabled = false .

2

Answers


  1. Chosen as BEST ANSWER

    Solved.

    tracker = new $.MouseTracker({
            element: this.viewer.canvas,
            pressHandler: setMouseNavEnabled(false),
            releaseHandler: setMouseNavEnabled(true),
    });
    

  2. There’s other ways to disable dragging:

        // Using viewer events
        viewer.addHandler('canvas-drag', (event) => {
          event.preventDefaultAction = true;
        });
    
        // Similar code can be used for the following viewer events:
        //   'canvas-key', 'canvas-scroll', 'canvas-click',
        //   'canvas-double-click', and 'canvas-drag'
    
        // For specific pointer devices
        viewer.gestureSettingsMouse.dragToPan = false;
        viewer.gestureSettingsTouch.dragToPan = true;
        viewer.gestureSettingsPen.dragToPan = true;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search