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:
parent
a057341bbf
commit
fd315326b4
1 changed files with 3 additions and 1 deletions
|
|
@ -567,7 +567,8 @@ class ConfluenceChart {
|
||||||
duplicate.type = 'button';
|
duplicate.type = 'button';
|
||||||
duplicate.dataset.action = 'duplicate';
|
duplicate.dataset.action = 'duplicate';
|
||||||
duplicate.textContent = 'Duplicate';
|
duplicate.textContent = 'Duplicate';
|
||||||
duplicate.addEventListener('click', event => {
|
duplicate.addEventListener('pointerdown', event => {
|
||||||
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const id = this.contextLineId || this.selectedLineId;
|
const id = this.contextLineId || this.selectedLineId;
|
||||||
const level = this.levels.find(value => value.id === id);
|
const level = this.levels.find(value => value.id === id);
|
||||||
|
|
@ -584,6 +585,7 @@ class ConfluenceChart {
|
||||||
this.hideContextMenu();
|
this.hideContextMenu();
|
||||||
if (id && this.onLineDelete) this.onLineDelete(id);
|
if (id && this.onLineDelete) this.onLineDelete(id);
|
||||||
});
|
});
|
||||||
|
this.contextMenu.addEventListener('pointerdown', event => event.stopPropagation());
|
||||||
this.contextMenu.addEventListener('click', event => event.stopPropagation());
|
this.contextMenu.addEventListener('click', event => event.stopPropagation());
|
||||||
this.contextMenu.append(endHere, extend, duplicate, deleteLine);
|
this.contextMenu.append(endHere, extend, duplicate, deleteLine);
|
||||||
this.overlayLayer.appendChild(this.contextMenu);
|
this.overlayLayer.appendChild(this.contextMenu);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue