Fixes for context menu & selection

This commit is contained in:
Piotr Pekala 2019-01-17 05:02:56 -08:00
parent b084677cf7
commit 347a3de22c

View File

@ -207,6 +207,10 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}
setUpMapCallbacks() {
if (!this.readonly) {
this.toolsService.selectionToolActivation(true);
}
const onNodeContextMenu = this.nodeWidget.onContextMenu.subscribe((eventNode: NodeContextMenu) => {
const node = this.mapNodeToNode.convert(eventNode.node);
this.contextMenu.openMenuForNode(node, eventNode.event.clientY, eventNode.event.clientX);
@ -219,7 +223,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
const onContextMenu = this.selectionTool.contextMenuOpened.subscribe((event) => {
const selectedItems = this.selectionManager.getSelected();
if (selectedItems.length === 0) return;
if (selectedItems.length === 0 || !(event instanceof MouseEvent)) return;
let drawings: Drawing[] = [];
let nodes: Node[] = [];