From 145bc737a6f234821c941a14e0a859a5c5eac307 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Thu, 11 Jul 2019 12:48:57 -0400 Subject: fixed image issue and added undo redo opacity changes --- src/client/documents/Documents.ts | 5 +++-- .../collections/collectionFreeForm/CollectionFreeFormView.tsx | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2