MouseLeave problem appeared with Gojs 2.2.21 update. I think it occurs with bug fixed in 2.2.20 update
“Corrected [GraphObject.mouseLeave] sometimes not getting called when the user’s pointer leaves the Diagram”
MouseLeave problem appeared with Gojs 2.2.21 update. I think it occurs with bug fixed in 2.2.20 update
“Corrected [GraphObject.mouseLeave] sometimes not getting called when the user’s pointer leaves the Diagram”
Did you have a question?
mouseover works after hovering over the image, even though I do nothing, mouseLeave is triggered
goMake(go.Picture, Tools.ExclamationShape,
{
name: "ErrorIcon",
desiredSize: new go.Size(16, 16),
alignment: go.Spot.TopRight,
mouseHover: (e: go.InputEvent, obj: go.GraphObject) => {
if (obj && obj.part && obj.part.data) {
this.showErrorMessages(obj.part.data.key);
}
},
mouseLeave: () => {
this.hideErrorMessages();
}
},
new go.Binding("visible", "", (val: any, obj: any) => {
return this.validationMessages.find((x) => x.itemKey === obj.part.data.key) ? true : false;
}),
),
What does showErrorMessages
do?
showErrorMessages(key?: string) {
if (this.validationMessages.find((i) => i.itemKey === key)) {
this.setState({ lastMouseOverKey: key });
if (this.errorMessagesDiv) {
let pt = this.diagram.lastInput.viewPoint;
this.errorMessagesDiv.style.left = (pt.x + 10) + "px";
this.errorMessagesDiv.style.top = (pt.y + 10) + "px";
this.errorMessagesDiv.style.display = "block";
}
}
}
Is that Div placed in a manner where the mouse would no longer be in the Diagram but in that Div instead? That would warrant a mouseLeave event.
Note that InputEvent.viewPoint is in view coordinates (i.e. the Diagram.div’s coordinates), not client or page or screen coordinates.