diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-03-14 21:21:12 -0400 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-03-14 21:21:12 -0400 |
commit | 599656b2dde4ba56e8cb6bbf9fb0fe2dee43c809 (patch) | |
tree | 8ae27dcbe9be2ac5c6332381e714db6f83fb644e /src/client/util/DragManager.ts | |
parent | 8811fb0f177ed1448fa7b3d08ff42145254a0475 (diff) | |
parent | 45c89c7b79a84fb918b656490f2bde9d1701d76a (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into filters
Diffstat (limited to 'src/client/util/DragManager.ts')
-rw-r--r-- | src/client/util/DragManager.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts index 437fea0ea..0d154bc3a 100644 --- a/src/client/util/DragManager.ts +++ b/src/client/util/DragManager.ts @@ -12,6 +12,7 @@ import { Docs, DocUtils } from "../documents/Documents"; import * as globalCssVariables from "../views/globalCssVariables.scss"; import { UndoManager } from "./UndoManager"; import { SnappingManager } from "./SnappingManager"; +import { DocumentView } from "../views/nodes/DocumentView"; export type dropActionType = "alias" | "copy" | "move" | "same" | "proto" | "none" | undefined; // undefined = move, "same" = move but don't call removeDropProperties export function SetupDrag( @@ -138,13 +139,14 @@ export namespace DragManager { isSelectionMove?: boolean; // indicates that an explicitly selected Document is being dragged. this will suppress onDragStart scripts } export class LinkDragData { - constructor(dragDoc: Doc, linkSourceGetAnchor: () => Doc) { - this.dragDocument = dragDoc; + constructor(dragView: DocumentView, linkSourceGetAnchor: () => Doc,) { + this.linkDragView = dragView; this.linkSourceGetAnchor = linkSourceGetAnchor; } - dragDocument: Doc; + get dragDocument() { return this.linkDragView.props.Document; } linkSourceGetAnchor: () => Doc; linkSourceDoc?: Doc; + linkDragView: DocumentView; } export class ColumnDragData { constructor(colKey: SchemaHeaderField) { @@ -253,8 +255,8 @@ export namespace DragManager { } // drags a linker button and creates a link on drop - export function StartLinkDrag(ele: HTMLElement, sourceDoc: Doc, sourceDocGetAnchor: undefined | (() => Doc), downX: number, downY: number, options?: DragOptions) { - StartDrag([ele], new DragManager.LinkDragData(sourceDoc, () => sourceDocGetAnchor?.() ?? sourceDoc), downX, downY, options); + export function StartLinkDrag(ele: HTMLElement, sourceView: DocumentView, sourceDocGetAnchor: undefined | (() => Doc), downX: number, downY: number, options?: DragOptions) { + StartDrag([ele], new DragManager.LinkDragData(sourceView, () => sourceDocGetAnchor?.() ?? sourceView.rootDoc), downX, downY, options); } // drags a column from a schema view |