aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-02-02 09:55:53 -0500
committerbobzel <zzzman@gmail.com>2023-02-02 09:55:53 -0500
commitee2401ac9138f7bb328ec5ff132fdcb21f7f2373 (patch)
treefb71612b7ca110ce31c6d489b4dfe98532440180
parent930bdf84ab4f4489f5072f9c082b732f060d880d (diff)
pause playing trails when collections are panned/zoomed. don't open mini trail player when following trail link if the trail is already shown
-rw-r--r--src/client/util/DocumentManager.ts2
-rw-r--r--src/client/util/LinkFollower.ts5
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx3
-rw-r--r--src/client/views/nodes/trails/PresBox.tsx4
4 files changed, 11 insertions, 3 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 7c867d710..088f2429d 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -38,10 +38,12 @@ export class DocumentManager {
this._viewRenderedCbs.push({ doc, func });
if (dv) {
this.callAddViewFuncs(dv);
+ return true;
}
} else {
func(undefined as any);
}
+ return false;
};
callAddViewFuncs = (view: DocumentView) => {
const callFuncs = this._viewRenderedCbs.filter(vc => vc.doc === view.rootDoc);
diff --git a/src/client/util/LinkFollower.ts b/src/client/util/LinkFollower.ts
index 57618b53c..bbfd516da 100644
--- a/src/client/util/LinkFollower.ts
+++ b/src/client/util/LinkFollower.ts
@@ -116,8 +116,9 @@ export class LinkFollower {
if (target.type === DocumentType.PRES) {
const containerDocContext = DocumentManager.GetContextPath(sourceDoc, true); // gather all views that affect layout of sourceDoc so we can revert them after playing the rail
SelectionManager.DeselectAll();
- DocumentManager.Instance.AddViewRenderedCb(target, dv => containerDocContext.length && (dv.ComponentView as PresBox).PlayTrail(containerDocContext));
- PresBox.OpenPresMinimized(target, [0, 0]);
+ if (!DocumentManager.Instance.AddViewRenderedCb(target, dv => containerDocContext.length && (dv.ComponentView as PresBox).PlayTrail(containerDocContext))) {
+ PresBox.OpenPresMinimized(target, [0, 0]);
+ }
finished?.();
} else {
const containerDocContext = DocumentManager.GetContextPath(target);
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 695d500e9..efd392110 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -715,6 +715,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
@action
scrollPan = (e: WheelEvent | { deltaX: number; deltaY: number }): void => {
+ PresBox.Instance?.pauseAutoPres();
const dx = e.deltaX;
const dy = e.deltaY;
this.setPan(NumCast(this.Document._panX) - dx, NumCast(this.Document._panY) - dy, 0, true);
@@ -722,6 +723,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
@action
pan = (e: PointerEvent | React.Touch | { clientX: number; clientY: number }): void => {
+ PresBox.Instance?.pauseAutoPres();
this.props.DocumentView?.().clearViewTransition();
const [dx, dy] = this.getTransform().transformDirection(e.clientX - this._lastX, e.clientY - this._lastY);
this.setPan(NumCast(this.Document._panX) - dx, NumCast(this.Document._panY) - dy, 0, true);
@@ -1016,6 +1018,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
@action
onPointerWheel = (e: React.WheelEvent): void => {
+ PresBox.Instance?.pauseAutoPres();
if (this.layoutDoc._Transform || DocListCast(Doc.MyOverlayDocs?.data).includes(this.props.Document) || this.props.Document.treeViewOutlineMode === TreeViewType.outline) return;
e.stopPropagation();
e.preventDefault();
diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index d9bc2d981..427911bd3 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -687,7 +687,9 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
* directly at start.
* @param startIndex: index that the presentation will start at
*/
+ @action
startPresentation = (startIndex: number) => {
+ PresBox.Instance = this;
clearTimeout(this._presTimer);
if (this.childDocs.length) {
this.layoutDoc.presStatus = PresStatus.Autoplay;
@@ -2122,7 +2124,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
@action
startOrPause = (makeActive = true) => {
makeActive && this.updateCurrentPresentation();
- if (this.layoutDoc.presStatus === PresStatus.Manual || this.layoutDoc.presStatus === PresStatus.Edit) this.startPresentation(this.itemIndex);
+ if (!this.layoutDoc.presStatus || this.layoutDoc.presStatus === PresStatus.Manual || this.layoutDoc.presStatus === PresStatus.Edit) this.startPresentation(this.itemIndex);
else this.pauseAutoPres();
};