@walter This is my function i used
diagram.toolManager.contextMenuTool.positionContextMenu = function (contextmenu, obj) {
if (contextmenu.placeholder !== null) return;
debugger; // eslint-disable-line no-debugger
const diagram = this.diagram;
const p = diagram.lastInput.documentPoint.copy();
const coordinates = obj?.part?.location;
let xCord = coordinates.x;
let yCord = coordinates.y;
p.x = xCord;
p.y = +yCord + +50;
contextmenu.position = p;
};
And this is my 3 dots code
$(
go.Picture,
{
width: 16,
height: 16,
column: 0,
source: `assets/img/threedots.svg`,
margin: new go.Margin(-20, 1, 2, 220),
imageAlignment: go.Spot.Right,
name: 'ThreeDotsExpanded',
},
{
click: (e, node) => e.diagram.commandHandler.showContextMenu(node),
}
),
This is context menu code
contextMenu: $(
'ContextMenu',
{ width: 160 },
$(
'ContextMenuButton',
$(go.TextBlock, 'View Price', {
stroke: '#161616',
alignment: go.Spot.Left,
margin: new go.Margin(1, 1, 1, 1),
}),
{
click: (e, node) => viewPriceDetails(e, node),
}
),
),
Now what happens is if you check above mockup diagram i sent , always view prices is coming near to 3 dots places. irrespective of user right clicked in the bottom of the node, Imagine node length is more than expected and somehow he scrolls to bottom and if we right click , he cant see context menu , since its showing in top of node , near to 3 dots
SO as per deisgn , 2 ways to see context menu ,
→ one is right click anywhere in node and there itself they can see the context menu (may be user scrolls to bottom of page and he right click bottom of node, there he can see context menu , exactly where he right clicked )
→ Other option is clicking in 3 dots , where context menu always shows next to it or adjacent to it
So either we need to know if its right or left clicked. Or for 3 dots menu click , is there any way i can send one parameter like ang get the same parameter in this function diagram.toolManager.contextMenuTool.positionContextMenu
{
click: (e, node) => e.diagram.commandHandler.showContextMenu(node,'clickFrom3dots'),
}