How to Pan while tracing by pressing and holding the left click of the mouse

Hi,

I tried this solution but its not that smooth pan. But I have figured something else from which we can do the second option which I had mentioned earlier. - Pan by clicking and dragging while tracing, (click and drag).

The idea is to use mouseLeftDown and mouseLeftUp event. Here take one variable say startPt, and then get mouse location with respect window’s coordinates on mouseLeftDown event. And clear that coordinate on mouseLeftUp. Use it with mouseMove event for panning now.

A short code snippet of working solution -

This is for mouseLeftDown

this._startPt = this.getMouseLocation(e);

This is for mouseMove event

const scrollView = this.docViewer.getScrollViewElement();
const location = this.getMouseLocation(e);
const xDelta = this._startPt.x - location.x;
const yDelta = this._startPt.y - location.y;
this.docViewer.scrollTo(scrollView.scrollLeft + xDelta, scrollView.scrollTop + yDelta);

Anyway. This is working now properly. Thanks for help.

1 Like