aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DragManager.ts
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2019-06-14 15:30:22 -0400
committerFawn <fangrui_tong@brown.edu>2019-06-14 15:30:22 -0400
commit05f0f145269fffc5dfada98a5f20bbc8e204bd28 (patch)
tree50031541e9361cc68b17f4c44f450f265fae5150 /src/client/util/DragManager.ts
parentf54496c7aa930e385e77aaf37df8d51db733e3a2 (diff)
cleaned up more link code
Diffstat (limited to 'src/client/util/DragManager.ts')
-rw-r--r--src/client/util/DragManager.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts
index 9ac421fbf..b4acbcffa 100644
--- a/src/client/util/DragManager.ts
+++ b/src/client/util/DragManager.ts
@@ -4,7 +4,7 @@ import { Cast } from "../../new_fields/Types";
import { emptyFunction } from "../../Utils";
import { CollectionDockingView } from "../views/collections/CollectionDockingView";
import * as globalCssVariables from "../views/globalCssVariables.scss";
-import { LinkManager, LinkUtils } from "./LinkManager";
+import { LinkManager } from "./LinkManager";
export type dropActionType = "alias" | "copy" | undefined;
export function SetupDrag(_reference: React.RefObject<HTMLElement>, docFunc: () => Doc | Promise<Doc>, moveFunc?: DragManager.MoveFunction, dropAction?: dropActionType) {
@@ -42,18 +42,13 @@ export function SetupDrag(_reference: React.RefObject<HTMLElement>, docFunc: ()
export async function DragLinksAsDocuments(dragEle: HTMLElement, x: number, y: number, sourceDoc: Doc) {
let srcTarg = sourceDoc.proto;
let draggedDocs: Doc[] = [];
- // let draggedFromDocs: Doc[] = [];
if (srcTarg) {
- // let linkToDocs = await DocListCastAsync(srcTarg.linkedToDocs);
- // let linkFromDocs = await DocListCastAsync(srcTarg.linkedFromDocs);
let linkDocs = LinkManager.Instance.findAllRelatedLinks(srcTarg);
- if (linkDocs) draggedDocs = linkDocs.map(link => {
- return LinkUtils.findOppositeAnchor(link, sourceDoc);
- });
-
-
- // if (linkToDocs) draggedDocs = linkToDocs.map(linkDoc => Cast(linkDoc.linkedTo, Doc) as Doc);
- // if (linkFromDocs) draggedFromDocs = linkFromDocs.map(linkDoc => Cast(linkDoc.linkedFrom, Doc) as Doc);
+ if (linkDocs) {
+ draggedDocs = linkDocs.map(link => {
+ return LinkManager.Instance.findOppositeAnchor(link, sourceDoc);
+ });
+ }
}
// draggedDocs.push(...draggedFromDocs);
if (draggedDocs.length) {