Hi Team,
I am using Gojs group (nested level) and I want to add custom hoverAdornment.
Hover Adornment:
It works for the outer gojs group but the mouse leave doesn’t get triggered if I move between 2 gojs groups. it only works, if I hover on a group and then move my focus back to the empty canvas area, then mouseLeave event is triggered. but the same won’t happen if I move my focus from one group to another group at the outer level or in the nested internal level.
here is my grp template code:
const hoverAdornment = (
shapeName: string,
): {
mouseEnter: (e: any, graphObject: GraphObject) => void;
mouseLeave: (e: any, graphObject: GraphObject) => void;
} => {
const mouseEnter = (_e: any, graphObject: GraphObject) => {
const shape: any = (graphObject as Panel).findObject(shapeName);
if (shape) {
shape.fill = 'green';
shape.stroke = 'green';
}
};
const mouseLeave = (_e: any, graphObject: GraphObject) => {
const shape: any = (graphObject as Panel).findObject(shapeName);
const isSelected = (graphObject as Part).isSelected;
if (shape) {
shape.fill = 'white';
shape.stroke = isSelected ? 'blue' : 'white';
}
};
return {
mouseEnter,
mouseLeave,
};
};
export const groupTemplate = (minWidth: number, minHeight: number, color: string, groupZOrder: zOrder) => {
return $(
Group,
'Auto',
groupShadow(),
settings(),
{ selectable: true },
{ zOrder: groupZOrder },
{ minSize: new Size(minWidth, minHeight) },
{ layout: diagramTreeLayout() },
{ isLayoutPositioned: true },
roundedPanel(
color,
true,
'flowShape',
{ alignment: Spot.Center },
hoverAdornment('flowShape'),
),
);
};
i use this group template to draw multiple gojs group on my canvas.
fyi, i checked the samples from gojs site and i do not see much of a difference between the sample code and the one i have wrote or is there any ?
do you see any issue with my code ?
any quick help will be really appreciated @walter :)