Hi,
As I understand, the property to set the tooltip delay (hoverDelay) is applicable at the diagram level.
Is there a way to apply this property to specific objects like ports?
Thanks in advance.
Hi,
As I understand, the property to set the tooltip delay (hoverDelay) is applicable at the diagram level.
Is there a way to apply this property to specific objects like ports?
Thanks in advance.
Did you want different delays for different objects?
I suppose you could override Tool | GoJS API on the ToolManager and call the super method with a different first argument.
Hi Walter,
Yes, I need to set different delays for different objects.
As suggested, I tried overriding the ToolManager class as following -
import { InputEvent, ToolManager } from 'gojs';
export class CanvasToolManager extends ToolManager {
constructor() {
super();
super.initializeStandardTools();
}
standardWaitAfter(delay: number, event?: InputEvent): void {
super.standardWaitAfter(delay, event);
}
}
I am creating an instance of this class while creating diagram object -
const diagram: go.Diagram = $(go.Diagram, element ? element.nativeElement : null, {
toolManager: new CanvasToolManager(),
});
In this case, I am getting a totally frozen canvas which is not at all interactive.
Please suggest if I am missing something here.
This is JavaScript rather than TypeScript, but it seems to work as I would have expected:
function CustomToolManager() {
go.ToolManager.call(this);
this.initializeStandardTools();
}
go.Diagram.inherit(CustomToolManager, go.ToolManager);
CustomToolManager.prototype.standardWaitAfter = function(delay, e) {
var currobj = e.diagram.findObjectAt(e.documentPoint);
if (currobj instanceof go.TextBlock) delay = 2000;
else if (currobj instanceof go.Shape) delay = 500;
go.ToolManager.prototype.standardWaitAfter.call(this, delay, e);
}
Install with:
myDiagram =
$(go.Diagram, . . .,
{
toolManager: new CustomToolManager(),
. . .
});
myDiagram.defaultTool = myDiagram.toolManager;