aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-04-24 09:56:59 -0400
committerbob <bcz@cs.brown.edu>2019-04-24 09:56:59 -0400
commitd2a95b1aa144e8dd4e87338525922dae1f3d9e67 (patch)
tree4fda48e270838626ca3c2c0edd1c9bdf7555d840 /src/client/views/DocumentDecorations.tsx
parent04b177406a98a52f4f8b3f94375f94db2f46a5df (diff)
added blacklist to stop docs form linking to their parent collection. refactored drag threshold to Utils
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 539f19707..5c57a829a 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -19,6 +19,7 @@ import { CompileScript } from "../util/Scripting";
import { IconBox } from "./nodes/IconBox";
import { FieldValue, Field } from "../../fields/Field";
import { Documents } from "../documents/Documents";
+import { Utils } from "../northstar/utils/Utils";
const higflyout = require("@hig/flyout");
export const { anchorPoints } = higflyout;
export const Flyout = higflyout.default;
@@ -207,8 +208,8 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
@action
onMinimizeMove = (e: PointerEvent): void => {
e.stopPropagation();
- let moved = Math.abs(e.pageX - this._downX) > 4 || Math.abs(e.pageY - this._downY) > 4;
- if (moved) {
+ if (Math.abs(e.pageX - this._downX) > Utils.DRAG_THRESHOLD ||
+ Math.abs(e.pageY - this._downY) > Utils.DRAG_THRESHOLD) {
let selDoc = SelectionManager.SelectedDocuments()[0];
let selDocPos = selDoc.props.ScreenToLocalTransform().scale(selDoc.props.ContentScaling()).inverse().transformPoint(0, 0);
let snapped = Math.abs(e.pageX - selDocPos[0]) < 20 && Math.abs(e.pageY - selDocPos[1]) < 20;
@@ -316,7 +317,9 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
if (this._linkerButton.current !== null) {
document.removeEventListener("pointermove", this.onLinkerButtonMoved);
document.removeEventListener("pointerup", this.onLinkerButtonUp);
- let dragData = new DragManager.LinkDragData(SelectionManager.SelectedDocuments()[0].props.Document);
+ let selDoc = SelectionManager.SelectedDocuments()[0];
+ let container = selDoc.props.ContainingCollectionView ? selDoc.props.ContainingCollectionView.props.Document.GetPrototype() : undefined;
+ let dragData = new DragManager.LinkDragData(selDoc.props.Document, container ? [container] : []);
DragManager.StartLinkDrag(this._linkerButton.current, dragData, e.pageX, e.pageY, {
handlers: {
dragComplete: action(emptyFunction),