diff options
author | yunahi <60233430+yunahi@users.noreply.github.com> | 2021-01-09 01:31:43 +0900 |
---|---|---|
committer | yunahi <60233430+yunahi@users.noreply.github.com> | 2021-01-09 01:31:43 +0900 |
commit | 768ab508529ab2b7f43a44592e5dc2c9f15a68a5 (patch) | |
tree | 05e8bbf1cabc27023875032a86554326519cf1b9 | |
parent | b4dea3a9ee58805504c50f963537e57c024e43e3 (diff) |
spotlight
-rw-r--r-- | src/client/views/collections/TabDocView.tsx | 10 | ||||
-rw-r--r-- | src/client/views/nodes/PresBox.tsx | 37 |
2 files changed, 44 insertions, 3 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx index 530595cd0..b3ad0f82e 100644 --- a/src/client/views/collections/TabDocView.tsx +++ b/src/client/views/collections/TabDocView.tsx @@ -142,6 +142,16 @@ export class TabDocView extends React.Component<TabDocViewProps> { pinDoc.presStartTime = 0; pinDoc.presEndTime = doc.duration; } + //save position + if (pinDoc.isInkMask) { + pinDoc.y = doc.y; + pinDoc.x = doc.x; + pinDoc.presHideAfter = true; + pinDoc.presHideBefore = true; + pinDoc.title = doc.title + "- Spotlight"; + pinDoc.presMovement = PresMovement.None; + + } if (curPres.expandBoolean) pinDoc.presExpandInlineButton = true; const dview = CollectionDockingView.Instance.props.Document; const fieldKey = CollectionDockingView.Instance.props.fieldKey; diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 683cb938a..56b4bb688 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -357,8 +357,8 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema> } else if (curDoc.presMovement === PresMovement.Pan && targetDoc) { await DocumentManager.Instance.jumpToDocument(targetDoc, false, openInTab, srcContext, undefined, undefined, undefined, includesDoc || tab ? undefined : resetSelection); // documents open in new tab instead of on right } else if ((curDoc.presMovement === PresMovement.Zoom || curDoc.presMovement === PresMovement.Jump) && targetDoc) { - //awaiting jump so that new scale can be found, since jumping is async - await DocumentManager.Instance.jumpToDocument(targetDoc, true, openInTab, srcContext, undefined, undefined, undefined, includesDoc || tab ? undefined : resetSelection); // documents open in new tab instead of on right + //awaiting jump so that new scale can be found, since jumping is async + await DocumentManager.Instance.jumpToDocument(targetDoc, true, openInTab, srcContext, undefined, undefined, undefined, includesDoc || tab ? undefined : resetSelection); // documents open in new tab instead of on right } // After navigating to the document, if it is added as a presPinView then it will // adjust the pan and scale to that of the pinView when it was added. @@ -367,6 +367,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema> this.navigateToView(targetDoc, activeItem); } // TODO: Add progressivize for navigating web (storing websites for given frames) + } /** @@ -470,6 +471,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema> this.next(); } } + await timer(duration); this.next(); // then the created Promise can be awaited if (i === this.childDocs.length - 1) { setTimeout(() => { @@ -673,11 +675,40 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema> //Regular click @action - selectElement = (doc: Doc) => { + selectElement = async (doc: Doc) => { const context = Cast(doc.context, Doc, null); this.gotoDocument(this.childDocs.indexOf(doc)); if (doc.presPinView || doc.presentationTargetDoc === this.layoutDoc.presCollection) setTimeout(() => this.updateCurrentPresentation(context), 0); else this.updateCurrentPresentation(context); + + + + if (this.targetDoc.isInkMask) { + if (this.activeItem.y !== undefined && + this.activeItem.x !== undefined && + this.targetDoc.y !== undefined && + this.targetDoc.y !== undefined) { + const timer = (ms: number) => new Promise(res => this._presTimer = setTimeout(res, ms)); + + const ydiff = this.activeItem.y - this.targetDoc.y; + const xdiff = this.activeItem.x - this.targetDoc.x; + + const time = 10; + + const yOffset = ydiff / time; + const xOffset = xdiff / time; + + for (let i = 0; i < time; i++) { + const newy = Number(this.targetDoc.y) + yOffset; + const newx = Number(this.targetDoc.x) + xOffset; + this.targetDoc.y = newy; + this.targetDoc.x = newx; + await timer(0.1); + } + + } + + } } //Command click |