diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
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<PanZoomDocument, P private _layoutSizeData = observable.map<string, { width?: number, height?: number }>(); private _cachedPool: Map<string, PoolData> = 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<PanZoomDocument, P document.addEventListener("pointerup", this.onPointerUp); // if not using a pen and in no ink mode if (CurrentUserUtils.SelectedTool === InkTool.None) { - this._batch = UndoManager.StartBatch("collectionErase"); + // this._batch = UndoManager.StartBatch("collectionErase"); this._downX = this._lastX = e.pageX; this._downY = this._lastY = e.pageY; } @@ -600,7 +599,6 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P } } - // @undoBatch @action onPointerUp = (e: PointerEvent): void => { if (!InteractionUtils.IsType(e, InteractionUtils.TOUCHTYPE)) { @@ -610,14 +608,18 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P this.removeEndListeners(); if (CurrentUserUtils.SelectedTool !== InkTool.None) { if (this._deleteList.length > 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(); } } } |