aboutsummaryrefslogtreecommitdiff
path: root/src/util/DragManager.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-01-31 11:51:01 -0500
committerbob <bcz@cs.brown.edu>2019-01-31 11:51:01 -0500
commite882783aeb3e425c339a15d80e602674261d2823 (patch)
tree6690bf438a94e8ccef7d8edc19b4dd59d85e0bf5 /src/util/DragManager.ts
parent0493f7f18a3eb49d0443f1742d53bb214bf9dd70 (diff)
just one more bug to fix with docking...
Diffstat (limited to 'src/util/DragManager.ts')
-rw-r--r--src/util/DragManager.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/util/DragManager.ts b/src/util/DragManager.ts
index 5a854c76d..a864a2bbe 100644
--- a/src/util/DragManager.ts
+++ b/src/util/DragManager.ts
@@ -6,7 +6,14 @@ import { CollectionDockingView } from "../views/collections/CollectionDockingVie
import { Document } from "../fields/Document";
export namespace DragManager {
- export let rootId = "root";
+ export function Root() {
+ const root = document.getElementById("root");
+ if (!root) {
+ throw new Error("No root element found");
+ }
+ return root;
+ }
+
let dragDiv: HTMLDivElement;
export enum DragButtons {
@@ -63,12 +70,8 @@ export namespace DragManager {
let _lastPointerY: number = 0;
export function StartDrag(ele: HTMLElement, dragData: { [ id: string ]: any }, options: DragOptions) {
if (!dragDiv) {
- const root = document.getElementById(rootId);
- if (!root) {
- throw new Error("No root element found");
- }
dragDiv = document.createElement("div");
- root.appendChild(dragDiv);
+ DragManager.Root().appendChild(dragDiv);
}
const w = ele.offsetWidth, h = ele.offsetHeight;
const rect = ele.getBoundingClientRect();