From bdce823ca6839fa7de4b927de484417bb596bba0 Mon Sep 17 00:00:00 2001
From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>
Date: Wed, 12 Aug 2020 14:52:28 +0800
Subject: bugs fixes from other comp

---
 src/client/views/presentationview/PresElementBox.tsx | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'src/client/views/presentationview/PresElementBox.tsx')

diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx
index a6dbb76ef..42b43b402 100644
--- a/src/client/views/presentationview/PresElementBox.tsx
+++ b/src/client/views/presentationview/PresElementBox.tsx
@@ -233,13 +233,23 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
     private _itemRef: React.RefObject<HTMLDivElement> = React.createRef();
     private _dragRef: React.RefObject<HTMLDivElement> = React.createRef();
 
+    @action
     headerDown = (e: React.PointerEvent<HTMLDivElement>) => {
-        const element = document.elementFromPoint(e.clientX, e.clientY)?.parentElement;
+        const element1 = document.elementFromPoint(e.clientX, e.clientY)?.parentElement;
+        const element = e.target as any;
         e.stopPropagation();
         e.preventDefault();
         if (element) {
             if (PresBox.Instance._eleArray.includes(element)) {
                 setupMoveUpEvents(this, e, this.startDrag, emptyFunction, emptyFunction);
+            } else {
+                PresBox.Instance._selectedArray = [];
+                PresBox.Instance._selectedArray.push(this.rootDoc);
+                PresBox.Instance._eleArray = [];
+                PresBox.Instance._eleArray.push(this._itemRef.current!);
+                PresBox.Instance._dragArray = [];
+                PresBox.Instance._dragArray.push(this._dragRef.current!);
+                setupMoveUpEvents(this, e, this.startDrag, emptyFunction, emptyFunction);
             }
         }
     }
-- 
cgit v1.2.3-70-g09d2

