From 148f82a8c1bf8e120ed293826a99426ba5047647 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Sun, 17 Oct 2021 20:17:37 +0200
Subject: [PATCH] [editor] Make all elements unclickable, only the overlay

- This helps getting rid of annoying element interaction and solves some
  selection issues (for example double clicking text elements to bring
  up the editor). While creating units, the placement and properties of
  the elements are important and not interacting with the elements.
  This is what the preview/player is for.
- This may also help with detecting selection for the Delete-key logic.
---
 .../unit-view/page-view/canvas/canvas-element-overlay.ts       | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-element-overlay.ts b/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-element-overlay.ts
index 7bc47388c..bfbb6a2af 100644
--- a/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-element-overlay.ts
+++ b/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-element-overlay.ts
@@ -33,6 +33,9 @@ export abstract class CanvasElementOverlay implements OnInit, OnDestroy {
     this.childComponent = this.elementContainer.createComponent(componentFactory);
     this.childComponent.instance.elementModel = this.element;
 
+    // Make children not clickable. This way the only relevant events are managed by the overlay.
+    this.childComponent.location.nativeElement.style.pointerEvents = 'none';
+
     this.selectionService.selectElement({ componentElement: this, multiSelect: false });
 
     if (this.childComponent.instance instanceof FormElementComponent) {
-- 
GitLab