aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/LightboxView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/LightboxView.tsx')
-rw-r--r--src/client/views/LightboxView.tsx18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx
index c8f6b5f0b..dd415212c 100644
--- a/src/client/views/LightboxView.tsx
+++ b/src/client/views/LightboxView.tsx
@@ -37,7 +37,7 @@ export class LightboxView extends React.Component<LightboxViewProps> {
@observable private static _tourMap: Opt<Doc[]> = []; // list of all tours available from the current target
private static _savedState: Opt<{ panX: Opt<number>, panY: Opt<number>, scale: Opt<number>, scrollTop: Opt<number> }>;
private static _history: Opt<{ doc: Doc, target?: Doc }[]> = [];
- private static _future: Opt<Doc[]> = [];
+ @observable private static _future: Opt<Doc[]> = [];
private static _docView: Opt<DocumentView>;
static path: { doc: Opt<Doc>, target: Opt<Doc>, history: Opt<{ doc: Doc, target?: Doc }[]>, future: Opt<Doc[]>, saved: Opt<{ panX: Opt<number>, panY: Opt<number>, scale: Opt<number>, scrollTop: Opt<number> }> }[] = [];
@action public static SetLightboxDoc(doc: Opt<Doc>, target?: Doc, future?: Doc[], layoutTemplate?: Doc) {
@@ -64,7 +64,7 @@ export class LightboxView extends React.Component<LightboxViewProps> {
}
}
if (future) {
- this._future = future.slice().sort((a, b) => NumCast(b._timecodeToShow) - NumCast(a._timecodeToShow)).sort((a, b) => DocListCast(a.links).length - DocListCast(b.links).length);
+ this._future = [...(this._future ?? []), ...(this.LightboxDoc ? [this.LightboxDoc] : []), ...future.slice().sort((a, b) => NumCast(b._timecodeToShow) - NumCast(a._timecodeToShow)).sort((a, b) => DocListCast(a.links).length - DocListCast(b.links).length),];
}
this._doc = doc;
this._layoutTemplate = layoutTemplate;
@@ -119,7 +119,7 @@ export class LightboxView extends React.Component<LightboxViewProps> {
addDocTab = LightboxView.AddDocTab;
@action public static Next() {
const doc = LightboxView._doc!;
- const target = LightboxView._docTarget = LightboxView._future?.pop();
+ const target = LightboxView._docTarget = this._future?.pop();
const targetDocView = target && DocumentManager.Instance.getLightboxDocumentView(target);
if (targetDocView && target) {
const l = DocUtils.MakeLinkToActiveAudio(() => targetDocView.ComponentView?.getAnchor?.() || target).lastElement();
@@ -164,11 +164,8 @@ export class LightboxView extends React.Component<LightboxViewProps> {
const docView = DocumentManager.Instance.getLightboxDocumentView(target || doc);
if (docView) {
LightboxView._docTarget = target;
- const focusSpeed = 1000;
- doc._viewTransition = `transform ${focusSpeed}ms`;
if (!target) docView.ComponentView?.shrinkWrap?.();
else docView.focus(target, { willZoom: true, scale: 0.9 });
- setTimeout(() => doc._viewTransition = undefined, focusSpeed);
}
else {
LightboxView.SetLightboxDoc(doc, target);
@@ -196,7 +193,9 @@ export class LightboxView extends React.Component<LightboxViewProps> {
const coll = LightboxView._docTarget;
if (coll) {
const fieldKey = Doc.LayoutFieldKey(coll);
- LightboxView.SetLightboxDoc(coll, undefined, [...DocListCast(coll[fieldKey]), ...DocListCast(coll[fieldKey + "-annotations"])]);
+ const contents = [...DocListCast(coll[fieldKey]), ...DocListCast(coll[fieldKey + "-annotations"])];
+ const links = DocListCast(coll.links).map(link => LinkManager.getOppositeAnchor(link, coll)).filter(doc => doc).map(doc => doc!);
+ LightboxView.SetLightboxDoc(coll, undefined, contents.length ? contents : links);
TabDocView.PinDoc(coll, { hidePresBox: true });
}
}
@@ -231,7 +230,7 @@ export class LightboxView extends React.Component<LightboxViewProps> {
const doc = LightboxView._doc;
const targetView = target && DocumentManager.Instance.getLightboxDocumentView(target);
if (doc === r.props.Document && (!target || target === doc)) r.ComponentView?.shrinkWrap?.();
- else target && targetView?.focus(target, { willZoom: true, scale: 0.9, instant: true });
+ //else target && targetView?.focus(target, { willZoom: true, scale: 0.9, instant: true }); // bcz: why was this here? it breaks smooth navigation in lightbox using 'next' button
}));
})}
Document={LightboxView.LightboxDoc}
@@ -248,7 +247,6 @@ export class LightboxView extends React.Component<LightboxViewProps> {
docFilters={this.docFilters}
removeDocument={undefined}
styleProvider={DefaultStyleProvider}
- layerProvider={returnTrue}
ScreenToLocalTransform={this.lightboxScreenToLocal}
PanelWidth={this.lightboxWidth}
PanelHeight={this.lightboxHeight}
@@ -271,7 +269,7 @@ export class LightboxView extends React.Component<LightboxViewProps> {
() => LightboxView.LightboxDoc && LightboxView._future?.length ? "" : "none", e => {
e.stopPropagation();
LightboxView.Next();
- })}
+ }, this.future()?.length.toString())}
<LightboxTourBtn navBtn={this.navBtn} future={this.future} stepInto={this.stepInto} tourMap={this.tourMap} />
<div className="lightboxView-tabBtn" title={"open in tab"}
onClick={e => {