diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 5 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index cda116570..62ec2f8bc 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -104,7 +104,7 @@ export namespace Docs { background: HistogramBox.LayoutString() }], [DocumentType.IMG, { - options: { height: 300, backgroundColor: "black" }, + options: { nativeWidth: 600, curPage: 0 }, primary: CollectionView.LayoutString("annotations"), background: ImageBox.LayoutString() }], @@ -202,7 +202,8 @@ export namespace Docs { let primary = template.primary; let background = template.background; let upper = Suffix.toUpperCase(); - let options = { ...defaultOptions, ...(template.options || {}), title: prototypeId.toUpperCase().replace(upper, `_${upper}`) }; + let title = prototypeId.toUpperCase().replace(upper, `_${upper}`); + let options = { title: title, type: type, ...defaultOptions, ...(template.options || {}) }; background && (options = { ...options, backgroundLayout: background, }); return Doc.assign(new Doc(prototypeId, true), { ...options, layout: primary, baseLayout: primary }); } diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 1867938a7..12240451b 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -283,12 +283,13 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) { const panY = this.Document.panY; const id = this.Document[Id]; const state = HistoryUtil.getState(); + state.initializers = state.initializers || {}; // TODO This technically isn't correct if type !== "doc", as // currently nothing is done, but we should probably push a new state if (state.type === "doc" && panX !== undefined && panY !== undefined) { - const init = state.initializers![id]; + const init = state.initializers[id]; if (!init) { - state.initializers![id] = { + state.initializers[id] = { panX, panY }; HistoryUtil.pushState(state); @@ -302,7 +303,7 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) { const newPanX = NumCast(doc.x) + NumCast(doc.width) / NumCast(doc.zoomBasis, 1) / 2; const newPanY = NumCast(doc.y) + NumCast(doc.height) / NumCast(doc.zoomBasis, 1) / 2; const newState = HistoryUtil.getState(); - newState.initializers![id] = { panX: newPanX, panY: newPanY }; + (newState.initializers || (newState.initializers = {}))[id] = { panX: newPanX, panY: newPanY }; HistoryUtil.pushState(newState); this.setPan(newPanX, newPanY); |