on touch devices when i try to move objects, it starts panning the canvas. Is there any way where i can prioritize the dragging first and pan on long hold?
First, notice that the DraggingTool takes priority over the PanningTool:
ToolManager | GoJS API
I don’t know if you want to change that ordering.
Second, consider decreasing the DraggingTool.delay, perhaps to zero.
DraggingTool | GoJS API
Third, implement a delay in the PanningTool by overriding its canStart method. Call the super method first and return false if it returned false. Otherwise return false if a touch event that happens before a delay that you specify in milliseconds:
. . .
const diagram = this.diagram;
// don't include the following check when this tool is running modally
if (diagram.currentTool !== this) {
if (e.isTouchEvent) {
// must wait for "delay" milliseconds before this tool can run
if (e.timestamp - diagram.firstInput.timestamp < ???) return false;
}
}
return true;
Note that I have not had time to test this code.
Thanks Walter!