From 2f3adfaf5dfc3acfa3f1f54c9334aebd3a91575a Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 7 Jun 2022 14:23:11 -0400 Subject: fixed bugs just introduced for presbox - numbering, minibox selection. --- src/client/views/OverlayView.tsx | 2 +- src/client/views/nodes/trails/PresBox.tsx | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx index 925cc3d2c..f5e686473 100644 --- a/src/client/views/OverlayView.tsx +++ b/src/client/views/OverlayView.tsx @@ -200,7 +200,7 @@ export class OverlayView extends React.Component { ScreenToLocalTransform={this.docScreenToLocalXf(d)} renderDepth={1} isDocumentActive={returnTrue} - isContentActive={emptyFunction} + isContentActive={returnTrue} whenChildContentsActiveChanged={emptyFunction} focus={DocUtils.DefaultFocus} styleProvider={DefaultStyleProvider} diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx index 980bdf4d6..1a4be8e0c 100644 --- a/src/client/views/nodes/trails/PresBox.tsx +++ b/src/client/views/nodes/trails/PresBox.tsx @@ -104,7 +104,7 @@ export class PresBox extends ViewBoxBaseComponent() { @observable private presentTools: boolean = false; @computed get isTreeOrStack() {return [CollectionViewType.Tree, CollectionViewType.Stacking].includes(StrCast(this.layoutDoc._viewType) as any) } @computed get isTree() { return this.layoutDoc._viewType === CollectionViewType.Tree;} - @computed get presFieldKey() { return StrCast(this.dataDoc.presFieldKey); } + @computed get presFieldKey() { return StrCast(this.layoutDoc.presFieldKey, "data"); } @computed get childDocs() { return DocListCast(this.rootDoc[this.presFieldKey]); } @observable _treeViewMap: Map = new Map(); @@ -625,15 +625,15 @@ export class PresBox extends ViewBoxBaseComponent() { * Called when the user changes the view type * Either 'List' (stacking) or 'Slides' (carousel) */ - // @undoBatch + @undoBatch viewChanged = action((e: React.ChangeEvent) => { //@ts-ignore const viewType = e.target.selectedOptions[0].value as CollectionViewType; + this.layoutDoc.presFieldKey = this.fieldKey+(viewType === CollectionViewType.Tree ?"-linearized":""); // pivot field may be set by the user in timeline view (or some other way) -- need to reset it here [CollectionViewType.Tree || CollectionViewType.Stacking].includes(viewType) && (this.rootDoc._pivotField = undefined); this.rootDoc._viewType = viewType; if (this.isTreeOrStack) { - this.layoutDoc.presFieldKey = this.fieldKey+(this.isTree ?"-linearized":""); this.layoutDoc._gridGap = 0; } }); @@ -2463,7 +2463,11 @@ export class PresBox extends ViewBoxBaseComponent() { } if (this._treeViewMap.get(treeViewDoc) !== indexNum) { this._treeViewMap.set(treeViewDoc, indexNum); - this.dataDoc[this.presFieldKey] = new List(this.sort(this._treeViewMap)); // this is a flat array of Docs + const sorted = this.sort(this._treeViewMap); + const curList = DocListCast(this.dataDoc[this.presFieldKey]); + if (sorted.length !== curList.length || sorted.some((doc,ind) => doc !== curList[ind])) { + this.dataDoc[this.presFieldKey] = new List(sorted); // this is a flat array of Docs + } } return this.childDocs; } @@ -2489,7 +2493,7 @@ export class PresBox extends ViewBoxBaseComponent() { const presEnd: boolean = !this.layoutDoc.presLoop && (this.itemIndex === this.childDocs.length - 1); const presStart: boolean = !this.layoutDoc.presLoop && (this.itemIndex === 0); return CurrentUserUtils.OverlayDocs.includes(this.rootDoc) ? -
+
e.stopPropagation()}>
{"Loop"}
}>
setupMoveUpEvents(this, e, returnFalse, returnFalse, () => this.layoutDoc.presLoop = !this.layoutDoc.presLoop, false, false)}>
-- cgit v1.2.3-70-g09d2