diff options
| author | bob <bcz@cs.brown.edu> | 2020-02-04 10:38:14 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2020-02-04 10:38:14 -0500 |
| commit | 92a5efa6876db1a497640aeb13fef5c8d99b102d (patch) | |
| tree | 7d10bfd9e0cfb3cd5c715410c645248571fdaff3 /src/client | |
| parent | 72f50feacb1c023d093b8169ef85e1e7773aa483 (diff) | |
fixing layout stuff
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/views/MetadataEntryMenu.tsx | 18 | ||||
| -rw-r--r-- | src/client/views/TemplateMenu.tsx | 18 | ||||
| -rw-r--r-- | src/client/views/collections/CollectionTimeView.tsx | 2 | ||||
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 15 |
4 files changed, 19 insertions, 34 deletions
diff --git a/src/client/views/MetadataEntryMenu.tsx b/src/client/views/MetadataEntryMenu.tsx index 23b21ae0c..ac152bf67 100644 --- a/src/client/views/MetadataEntryMenu.tsx +++ b/src/client/views/MetadataEntryMenu.tsx @@ -133,23 +133,7 @@ export class MetadataEntryMenu extends React.Component<MetadataEntryProps>{ } getKeySuggestions = async (value: string): Promise<string[]> => { - value = value.toLowerCase(); - let docs = this.props.docs; - if (typeof docs === "function") { - if (this.props.suggestWithFunction) { - docs = docs(); - } else { - return []; - } - } - docs = await docs; - if (docs instanceof Doc) { - return Object.keys(docs).filter(key => key.toLowerCase().startsWith(value)); - } else { - const keys = new Set<string>(); - docs.forEach(doc => Doc.allKeys(doc).forEach(key => keys.add(key))); - return Array.from(keys).filter(key => key.toLowerCase().startsWith(value)); - } + return []; } getSuggestionValue = (suggestion: string) => suggestion; diff --git a/src/client/views/TemplateMenu.tsx b/src/client/views/TemplateMenu.tsx index f61eb9cd0..9b0199eac 100644 --- a/src/client/views/TemplateMenu.tsx +++ b/src/client/views/TemplateMenu.tsx @@ -94,15 +94,15 @@ export class TemplateMenu extends React.Component<TemplateMenuProps> { } } componentDidMount() { - !this._addedKeys && (this._addedKeys = new ObservableSet()); - Array.from(Object.keys(Doc.GetProto(this.props.docViews[0].props.Document))). - filter(key => key.startsWith("layout_")). - map(key => runInAction(() => this._addedKeys.add(key.replace("layout_", "")))); - DocListCast(Cast(CurrentUserUtils.UserDocument.expandingButtons, Doc, null)?.data)?.map(btnDoc => { - if (StrCast(Cast(btnDoc?.dragFactory, Doc, null)?.title)) { - runInAction(() => this._addedKeys.add(StrCast(Cast(btnDoc?.dragFactory, Doc, null)?.title))); - } - }); + // !this._addedKeys && (this._addedKeys = new ObservableSet()); + // Array.from(Object.keys(Doc.GetProto(this.props.docViews[0].props.Document))). + // filter(key => key.startsWith("layout_")). + // map(key => runInAction(() => this._addedKeys.add(key.replace("layout_", "")))); + // DocListCast(Cast(CurrentUserUtils.UserDocument.expandingButtons, Doc, null)?.data)?.map(btnDoc => { + // if (StrCast(Cast(btnDoc?.dragFactory, Doc, null)?.title)) { + // runInAction(() => this._addedKeys.add(StrCast(Cast(btnDoc?.dragFactory, Doc, null)?.title))); + // } + // }); } _addedKeys = new ObservableSet(); diff --git a/src/client/views/collections/CollectionTimeView.tsx b/src/client/views/collections/CollectionTimeView.tsx index 253dfa890..d1e2844df 100644 --- a/src/client/views/collections/CollectionTimeView.tsx +++ b/src/client/views/collections/CollectionTimeView.tsx @@ -43,7 +43,7 @@ export class CollectionTimeView extends CollectionSubView(doc => doc) { @computed get _allFacets() { const facets = new Set<string>(); - this.childDocs.forEach(child => Object.keys(Doc.GetProto(child)).forEach(key => facets.add(key))); + //this.childDocs.forEach(child => Object.keys(Doc.GetProto(child)).forEach(key => facets.add(key))); return facets.toArray(); } diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 6453cfe17..63544a637 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -824,13 +824,14 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) { } get doLayoutComputation() { const { newPool, computedElementData } = this.doInternalLayoutComputation; - Array.from(newPool.keys()).map(key => { - const lastPos = this._cachedPool.get(key); // last computed pos - const newPos = newPool.get(key); - if (!lastPos || newPos.x !== lastPos.x || newPos.y !== lastPos.y || newPos.z !== lastPos.z || newPos.zIndex !== lastPos.zIndex || newPos.width !== lastPos.width || newPos.height !== lastPos.height) { - runInAction(() => this._layoutPoolData.set(key, { transition: "transform 1s", ...newPos })); - } - }); + runInAction(() => + Array.from(newPool.keys()).map(key => { + const lastPos = this._cachedPool.get(key); // last computed pos + const newPos = newPool.get(key); + if (!lastPos || newPos.x !== lastPos.x || newPos.y !== lastPos.y || newPos.z !== lastPos.z || newPos.zIndex !== lastPos.zIndex || newPos.width !== lastPos.width || newPos.height !== lastPos.height) { + this._layoutPoolData.set(key, newPos); + } + })); this._cachedPool.clear(); Array.from(newPool.keys()).forEach(k => this._cachedPool.set(k, newPool.get(k))); this.childLayoutPairs.filter((pair, i) => this.isCurrent(pair.layout)).forEach(pair => |
