aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-30 12:16:24 -0400
committerbobzel <zzzman@gmail.com>2020-09-30 12:16:24 -0400
commit58f83cc1eef844420e5b418011231f995c9cf043 (patch)
treee610c7b8ad166054ba5a3579371200565131c98b /src/client/views/DocumentDecorations.tsx
parentb1ddfbe0a393dce03a8e5da9d70e9a46dc3b9755 (diff)
fixed dragging aliases using alias button. made dragging title of doc decorations or alias button allow doc to be embedded
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 9432d1ffb..fa7220e7d 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -119,7 +119,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
}
}
@action onTitleDown = (e: React.PointerEvent): void => {
- setupMoveUpEvents(this, e, this.onBackgroundMove, (e) => { }, this.onTitleClick);
+ setupMoveUpEvents(this, e, e => this.onBackgroundMove(true, e), (e) => { }, this.onTitleClick);
}
@action onTitleClick = (e: PointerEvent): void => {
!this._edtingTitle && (this._accumulatedTitle = this._titleControlString.startsWith("#") ? this.selectionTitle : this._titleControlString);
@@ -128,22 +128,26 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
}
onBackgroundDown = (e: React.PointerEvent): void => {
- setupMoveUpEvents(this, e, this.onBackgroundMove, (e) => { }, (e) => { });
+ setupMoveUpEvents(this, e, e => this.onBackgroundMove(false, e), (e) => { }, (e) => { });
}
@action
- onBackgroundMove = (e: PointerEvent, down: number[]): boolean => {
+ onBackgroundMove = (dragTitle: boolean, e: PointerEvent): boolean => {
const dragDocView = SelectionManager.SelectedDocuments()[0];
const dragData = new DragManager.DocumentDragData(SelectionManager.SelectedDocuments().map(dv => dv.props.Document));
const [left, top] = dragDocView.props.ScreenToLocalTransform().scale(dragDocView.props.ContentScaling()).inverse().transformPoint(0, 0);
dragData.offset = dragDocView.props.ScreenToLocalTransform().scale(dragDocView.props.ContentScaling()).transformDirection(e.x - left, e.y - top);
dragData.moveDocument = dragDocView.props.moveDocument;
dragData.isSelectionMove = true;
+ dragData.canEmbed = dragTitle;
dragData.dropAction = dragDocView.props.dropAction;
this.Interacting = true;
this._hidden = true;
DragManager.StartDocumentDrag(SelectionManager.SelectedDocuments().map(dv => dv.ContentDiv!), dragData, e.x, e.y, {
- dragComplete: action(e => this._hidden = this.Interacting = false),
+ dragComplete: action(e => {
+ dragData.canEmbed && SelectionManager.DeselectAll();
+ this._hidden = this.Interacting = false;
+ }),
hideSource: true
});
return true;