Stop chart pointerdown from eating Duplicate on the context menu.

The menu sits inside the chart element, so pointerdown bubbled into
pan/tool capture and the Duplicate click never ran.
This commit is contained in:
Chris Amow 2026-08-28 15:20:32 -05:00
parent a057341bbf
commit fd315326b4

View file

@ -567,7 +567,8 @@ class ConfluenceChart {
duplicate.type = 'button';
duplicate.dataset.action = 'duplicate';
duplicate.textContent = 'Duplicate';
duplicate.addEventListener('click', event => {
duplicate.addEventListener('pointerdown', event => {
event.preventDefault();
event.stopPropagation();
const id = this.contextLineId || this.selectedLineId;
const level = this.levels.find(value => value.id === id);
@ -584,6 +585,7 @@ class ConfluenceChart {
this.hideContextMenu();
if (id && this.onLineDelete) this.onLineDelete(id);
});
this.contextMenu.addEventListener('pointerdown', event => event.stopPropagation());
this.contextMenu.addEventListener('click', event => event.stopPropagation());
this.contextMenu.append(endHere, extend, duplicate, deleteLine);
this.overlayLayer.appendChild(this.contextMenu);