aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-08-03 13:33:38 -0400
committerbobzel <zzzman@gmail.com>2022-08-03 13:33:38 -0400
commit55bac585fa0b8d6c3f513ccecb22456d1d361040 (patch)
tree3c4886b07ba775e656f264874d8552992f087abd /src/client/views/nodes/DocumentView.tsx
parent4ad4936393d11227934fdda2c18bea3446b20795 (diff)
fixes for dragging notes so that they highlight properly and go to the right place when embedded in freeform views.
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index afb618b34..1ee1aec5a 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -156,9 +156,7 @@ export interface DocumentViewSharedProps {
scriptContext?: any; // can be assigned anything and will be passed as 'scriptContext' to any OnClick script that executes on this document
createNewFilterDoc?: () => void;
updateFilterDoc?: (doc: Doc) => void;
- // Parker added both of these
- originalBackgroundColor?: string;
- isNoteTakingView?: boolean;
+ dontHideOnDrag?: boolean;
}
// these props are specific to DocuentViews
@@ -494,12 +492,6 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
startDragging(x: number, y: number, dropAction: dropActionType, hideSource = false) {
if (this._mainCont.current) {
const dragData = new DragManager.DocumentDragData([this.props.Document]);
- if (this.props.isNoteTakingView) {
- dragData.draggedDocuments.forEach((doc) => {
- doc.backgroundColor = "#C9DAEF";
- doc.opacity = 0.5;
- });
- }
const [left, top] = this.props.ScreenToLocalTransform().scale(this.NativeDimScaling).inverse().transformPoint(0, 0);
dragData.offset = this.props
.ScreenToLocalTransform()
@@ -511,22 +503,16 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
dragData.treeViewDoc = this.props.treeViewDoc;
dragData.removeDocument = this.props.removeDocument;
dragData.moveDocument = this.props.moveDocument;
- //dragData.dimSource :
- // dragEffects field, set dim
+ //dragData.dimSource :
+ // dragEffects field, set dim
// add kv pairs to a doc, swap properties with the node while dragging, and then swap when dropping
// add a dragEffects prop to DocumentView as a function that sets up. Each view has its own prop, when you start dragging:
- // in Draganager, figure out which doc(s) you're dragging and change what opacity function returns
+ // in Draganager, figure out which doc(s) you're dragging and change what opacity function returns
const ffview = this.props.CollectionFreeFormDocumentView?.().props.CollectionFreeFormView;
- ffview && runInAction(() => (ffview.ChildDrag = this.props.DocumentView()));
- DragManager.StartDocumentDrag([this._mainCont.current], dragData, x, y, { hideSource: hideSource || (!dropAction && !this.layoutDoc.onDragStar && !this.props.isNoteTakingView)},
- () => setTimeout(action(() => {
- ffview && (ffview.ChildDrag = undefined)
- //TODO: is there a better way than adding another field to the props? Not quite sure how "this" works tbh
- if (this.props.isNoteTakingView) {
- this.props.Document.backgroundColor = "";
- this.props.Document.opacity = 1;
- }
- }))); // this needs to happen after the drop event is processed.
+ ffview && runInAction(() => (ffview.ChildDrag = this.props.DocumentView()));
+ DragManager.StartDocumentDrag([this._mainCont.current], dragData, x, y, { hideSource: hideSource || (!dropAction && !this.layoutDoc.onDragStart && !this.props.dontHideOnDrag) }, () =>
+ setTimeout(action(() => ffview && (ffview.ChildDrag = undefined)))
+ ); // this needs to happen after the drop event is processed.
ffview?.setupDragLines(false);
}
}