From 44c3ed6af9516c7bb91785934a997c7ab054ec5f Mon Sep 17 00:00:00 2001 From: vkalev Date: Fri, 12 Nov 2021 16:54:51 -0500 Subject: undo works with ink deletion --- .../collections/collectionFreeForm/CollectionFreeFormView.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 018f4f79a..bd72e4af9 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -99,7 +99,6 @@ export class CollectionFreeFormView extends CollectionSubView(); private _cachedPool: Map = new Map(); private _lastTap = 0; - private _batch: UndoManager.Batch | undefined = undefined; private get isAnnotationOverlay() { return this.props.isAnnotationOverlay; } private get scaleFieldKey() { return this.props.scaleField || "_viewScale"; } @@ -450,7 +449,7 @@ export class CollectionFreeFormView extends CollectionSubView { if (!InteractionUtils.IsType(e, InteractionUtils.TOUCHTYPE)) { @@ -610,14 +608,18 @@ export class CollectionFreeFormView extends CollectionSubView 0) { + // Ensuring ink opacity returns to normal if the user undos after deletion. this._deleteList.forEach(ink => { ink.Document.opacity = 1; + }); + const batch = UndoManager.StartBatch("collectionErase"); + this._deleteList.forEach(ink => { ink.props.removeDocument?.(ink.props.Document); }); + batch.end(); } this._prevPoint = this._currPoint = { X: -1, Y: -1 }; this._deleteList = []; - this._batch?.end(); } } } -- cgit v1.2.3-70-g09d2