aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
authorljungster <parkerljung@gmail.com>2022-04-11 20:16:40 -0400
committerljungster <parkerljung@gmail.com>2022-04-11 20:16:40 -0400
commit1e044cdb3d9004a42dfce5de83f518e95aebaf40 (patch)
tree10a33aa97591d275fb7a70df5da41afbbf5c0e70 /src/client/views/nodes/DocumentView.tsx
parent5476f6160a357fe697314e6171ff560260c1d301 (diff)
items get dragged and dropped
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 7092b335c..51820e77c 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -144,6 +144,9 @@ 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;
}
export interface DocumentViewProps extends DocumentViewSharedProps {
// properties specific to DocumentViews but not to FieldView
@@ -409,6 +412,10 @@ 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]);
+ dragData.draggedDocuments.forEach((doc) => {
+ doc.backgroundColor = "#C9DAEF"
+ doc.opacity = 0.5
+ })
const [left, top] = this.props.ScreenToLocalTransform().scale(this.ContentScale).inverse().transformPoint(0, 0);
dragData.offset = this.props.ScreenToLocalTransform().scale(this.ContentScale).transformDirection(x - left, y - top);
dragData.dropAction = dropAction;
@@ -416,9 +423,16 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
dragData.removeDocument = this.props.removeDocument;
dragData.moveDocument = this.props.moveDocument;
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.onDragStart) },
- () => setTimeout(action(() => ffview && (ffview.ChildDrag = undefined)))); // 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.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?.setupDragLines(false);
}
}