Go.js ver 1.6.11
Using a mouse select tool without breaking double click.
So this worked in go.js 1.4, and I’m trying to figure out what changed so I can fix it.
I have a diagram with objects that can be duplicated, and I have a custom mouseSelect function to select the duplicates when one of them is selected:
var tool = this.diagram.toolManager.clickSelectingTool;
tool.standardMouseSelect = function() {
var diagram = tool.diagram;
var e = diagram.lastInput;
var curObj = diagram.findPartAt(e.documentPoint, false);
var partsToSelect = getDataNodesWithSameNameAsNode(curObj);
if (partsToSelect.length > 0) {
diagram.selectCollection(partsToSelect)
} else {
go.ClickSelectingTool.prototype.standardMouseSelect.call(tool);
}
};
However, this means that some objects aren’t getting doubleClick functions fired when they should. It seems like you have to have an object selected, then double click, in order to get the double click to fire (probably because then the canStart on the selection tool is returning false in that case?)
Is there a way for me to maintain this behavior but prevent the tool from affecting the doubleClick action? I tried to more or less copy the tool override design in the samples, but I might’ve missed one of the finer points while adapting the code.