diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/LinkManager.ts | 4 | ||||
-rw-r--r-- | src/client/views/LightboxView.tsx | 30 | ||||
-rw-r--r-- | src/client/views/collections/CollectionStackingView.tsx | 11 | ||||
-rw-r--r-- | src/client/views/nodes/LinkAnchorBox.tsx | 3 | ||||
-rw-r--r-- | src/client/views/nodes/PresBox.tsx | 1 |
5 files changed, 25 insertions, 24 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index c39a4abda..1e6e02e55 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -145,12 +145,8 @@ export class LinkManager { if (linkDoc) { const target = (doc === linkDoc.anchor1 ? linkDoc.anchor2 : doc === linkDoc.anchor2 ? linkDoc.anchor1 : (Doc.AreProtosEqual(doc, linkDoc.anchor1 as Doc) || Doc.AreProtosEqual((linkDoc.anchor1 as Doc).annotationOn as Doc, doc) ? linkDoc.anchor2 : linkDoc.anchor1)) as Doc; - const targetTimecode = (doc === linkDoc.anchor1 ? Cast(linkDoc.anchor2_timecode, "number") : - doc === linkDoc.anchor2 ? Cast(linkDoc.anchor1_timecode, "number") : - (Doc.AreProtosEqual(doc, linkDoc.anchor1 as Doc) || Doc.AreProtosEqual((linkDoc.anchor1 as Doc).annotationOn as Doc, doc) ? Cast(linkDoc.anchor2_timecode, "number") : Cast(linkDoc.anchor1_timecode, "number"))); if (target) { const containerDoc = Cast(target.annotationOn, Doc, null) || target; - targetTimecode !== undefined && (containerDoc._currentTimecode = targetTimecode); const targetContext = Cast(containerDoc?.context, Doc, null); const targetNavContext = !Doc.AreProtosEqual(targetContext, currentContext) ? targetContext : undefined; DocumentManager.Instance.jumpToDocument(target, zoom, (doc, finished) => createViewFunc(doc, StrCast(linkDoc.followLinkLocation, "add:right"), finished), targetNavContext, linkDoc, undefined, doc, finished); diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx index 7fab88800..d36c3ad4f 100644 --- a/src/client/views/LightboxView.tsx +++ b/src/client/views/LightboxView.tsx @@ -44,15 +44,15 @@ export class LightboxView extends React.Component<LightboxViewProps> { }; } if (future) { - LightboxView.LightboxFuture = future.slice(); + LightboxView.LightboxFuture = future.slice().sort((a, b) => DocListCast(a.links).length - DocListCast(b.links).length); } LightboxView.LightboxDoc = LightboxView.LightboxDocTarget = doc; return true; } public static IsLightboxDocView(path: DocumentView[]) { return path.includes(LightboxView.LightboxDocView!); } - public static LightboxHistory: (Opt<Doc>)[] = []; - public static LightboxFuture: (Opt<Doc>)[] = []; + public static LightboxHistory: Opt<Doc[]> = []; + public static LightboxFuture: Opt<Doc[]> = []; public static LightboxDocView: Opt<DocumentView>; @computed get leftBorder() { return Math.min(this.props.PanelWidth / 4, this.props.maxBorder[0]); } @computed get topBorder() { return Math.min(this.props.PanelHeight / 4, this.props.maxBorder[1]); } @@ -73,14 +73,18 @@ export class LightboxView extends React.Component<LightboxViewProps> { } public static AddDocTab = (doc: Doc, location: string) => { SelectionManager.DeselectAll(); - return LightboxView.SetLightboxDoc(doc, [...DocListCast(doc[Doc.LayoutFieldKey(doc)]), ...DocListCast(doc[Doc.LayoutFieldKey(doc) + "-annotations"])] - .sort((a: Doc, b: Doc) => NumCast(b._timecodeToShow) - NumCast(a._timecodeToShow))); + return LightboxView.SetLightboxDoc(doc, + [...DocListCast(doc[Doc.LayoutFieldKey(doc)]), + ...DocListCast(doc[Doc.LayoutFieldKey(doc) + "-annotations"]), + ...(LightboxView.LightboxFuture ?? []) + ] + .sort((a: Doc, b: Doc) => NumCast(b._timecodeToShow) - NumCast(a._timecodeToShow))); } addDocTab = LightboxView.AddDocTab; fitToBox = () => LightboxView.LightboxDocTarget === LightboxView.LightboxDoc; render() { - if (LightboxView.LightboxHistory.lastElement() !== LightboxView.LightboxDoc) LightboxView.LightboxHistory.push(LightboxView.LightboxDoc); + if (LightboxView.LightboxHistory?.lastElement() !== LightboxView.LightboxDoc) LightboxView.LightboxHistory?.push(LightboxView.LightboxDoc!); let downx = 0, downy = 0; return !LightboxView.LightboxDoc ? (null) : <div className="lightboxView-frame" @@ -134,28 +138,28 @@ export class LightboxView extends React.Component<LightboxViewProps> { renderDepth={0} /> </div> {this.navBtn(undefined, "chevron-left", - () => LightboxView.LightboxDoc && LightboxView.LightboxHistory.length ? "" : "none", + () => LightboxView.LightboxDoc && LightboxView.LightboxHistory?.length ? "" : "none", action(e => { e.stopPropagation(); - const previous = LightboxView.LightboxHistory.pop(); - const target = LightboxView.LightboxDocTarget = LightboxView.LightboxHistory.lastElement(); + const previous = LightboxView.LightboxHistory?.pop(); + const target = LightboxView.LightboxDocTarget = LightboxView.LightboxHistory?.lastElement(); const docView = target && DocumentManager.Instance.getLightboxDocumentView(target); if (docView && target) { - if (LightboxView.LightboxFuture.lastElement() !== previous) LightboxView.LightboxFuture.push(previous); + if (LightboxView.LightboxFuture?.lastElement() !== previous) LightboxView.LightboxFuture?.push(previous!); docView.focus(target, true, 0.9); } else { LightboxView.SetLightboxDoc(target); } }))} {this.navBtn(this.props.PanelWidth - Math.min(this.props.PanelWidth / 4, this.props.maxBorder[0]), "chevron-right", - () => LightboxView.LightboxDoc && LightboxView.LightboxFuture.length ? "" : "none", + () => LightboxView.LightboxDoc && LightboxView.LightboxFuture?.length ? "" : "none", action(e => { e.stopPropagation(); - const target = LightboxView.LightboxDocTarget = LightboxView.LightboxFuture.pop(); + const target = LightboxView.LightboxDocTarget = LightboxView.LightboxFuture?.pop(); const docView = target && DocumentManager.Instance.getLightboxDocumentView(target); if (docView && target) { docView.focus(target, true, 0.9); - if (LightboxView.LightboxHistory.lastElement() !== target) LightboxView.LightboxHistory.push(target); + if (LightboxView.LightboxHistory?.lastElement() !== target) LightboxView.LightboxHistory?.push(target); } else { LightboxView.SetLightboxDoc(target); } diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index 6425e1625..2d03c5279 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -44,7 +44,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument, _draggerRef = React.createRef<HTMLDivElement>(); _pivotFieldDisposer?: IReactionDisposer; _autoHeightDisposer?: IReactionDisposer; - _docXfs: any[] = []; + _docXfs: { height: () => number, width: () => number, stackedDocTransform: () => Transform }[] = []; _columnStart: number = 0; @observable _heightMap = new Map<string, number>(); @observable _cursor: CursorProperty = "grab"; @@ -204,6 +204,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument, let dref: Opt<HTMLDivElement>; const stackedDocTransform = () => this.getDocTransform(doc, dref); + this._docXfs.push({ stackedDocTransform, width, height }); return <DocumentView ref={r => dref = r?.ContentDiv ? r.ContentDiv : undefined} Document={doc} DataDoc={dataDoc || (!Doc.AreProtosEqual(doc[DataSym], doc) && doc[DataSym])} @@ -295,8 +296,8 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument, let dropAfter = 0; if (de.complete.docDragData) { this._docXfs.map((cd, i) => { - const pos = cd.dxf().inverse().transformPoint(-2 * this.gridGap, -2 * this.gridGap); - const pos1 = cd.dxf().inverse().transformPoint(cd.width(), cd.height()); + const pos = cd.stackedDocTransform().inverse().transformPoint(-2 * this.gridGap, -2 * this.gridGap); + const pos1 = cd.stackedDocTransform().inverse().transformPoint(cd.width(), cd.height()); if (where[0] > pos[0] && where[0] < pos1[0] && where[1] > pos[1] && (i === this._docXfs.length - 1 || where[1] < pos1[1])) { dropInd = i; const axis = this.Document._viewType === CollectionViewType.Masonry ? 0 : 1; @@ -327,8 +328,8 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument, const where = [e.clientX, e.clientY]; let targInd = -1; this._docXfs.map((cd, i) => { - const pos = cd.dxf().inverse().transformPoint(-2 * this.gridGap, -2 * this.gridGap); - const pos1 = cd.dxf().inverse().transformPoint(cd.width(), cd.height()); + const pos = cd.stackedDocTransform().inverse().transformPoint(-2 * this.gridGap, -2 * this.gridGap); + const pos1 = cd.stackedDocTransform().inverse().transformPoint(cd.width(), cd.height()); if (where[0] > pos[0] && where[0] < pos1[0] && where[1] > pos[1] && where[1] < pos1[1]) { targInd = i; } diff --git a/src/client/views/nodes/LinkAnchorBox.tsx b/src/client/views/nodes/LinkAnchorBox.tsx index db5414069..d76b61502 100644 --- a/src/client/views/nodes/LinkAnchorBox.tsx +++ b/src/client/views/nodes/LinkAnchorBox.tsx @@ -124,8 +124,7 @@ export class LinkAnchorBox extends ViewBoxBaseComponent<FieldViewProps, LinkAnch const anchor = this.fieldKey === "anchor1" ? "anchor2" : "anchor1"; const anchorScale = !this.dataDoc[this.fieldKey + "-useLinkSmallAnchor"] && (x === 0 || x === 100 || y === 0 || y === 100) ? 1 : .25; - const timecode = this.dataDoc[anchor + "_timecode"]; - const targetTitle = StrCast((this.dataDoc[anchor] as Doc)?.title) + (timecode !== undefined ? ":" + timecode : ""); + const targetTitle = StrCast((this.dataDoc[anchor] as Doc)?.title); const flyout = ( <div className="linkAnchorBoxBox-flyout" title=" " onPointerOver={() => Doc.UnBrushDoc(this.rootDoc)}> <LinkEditor sourceDoc={Cast(this.dataDoc[this.fieldKey], Doc, null)} hideback={true} linkDoc={this.rootDoc} showLinks={action(() => { })} /> diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 77b050abe..b9480fa74 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -70,6 +70,7 @@ export class PinProps { audioRange?: boolean; unpin?: boolean; setPosition?: boolean; + hidePresBox?: boolean; } type PresBoxSchema = makeInterface<[typeof documentSchema]>; |