From ec578023e2147ff4f14724bb94cb47191076e793 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 14 Dec 2023 09:59:12 -0500 Subject: fixed lightbox view and multirow/col --- src/client/views/InkStrokeProperties.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/client/views/InkStrokeProperties.ts') diff --git a/src/client/views/InkStrokeProperties.ts b/src/client/views/InkStrokeProperties.ts index 69c663a3e..a628c7120 100644 --- a/src/client/views/InkStrokeProperties.ts +++ b/src/client/views/InkStrokeProperties.ts @@ -1,5 +1,5 @@ import { Bezier } from 'bezier-js'; -import { action, makeObservable, observable, reaction } from 'mobx'; +import { action, makeObservable, observable, reaction, runInAction } from 'mobx'; import { Doc, NumListCast, Opt } from '../../fields/Doc'; import { InkData, InkField, InkTool, PointData } from '../../fields/InkField'; import { List } from '../../fields/List'; @@ -84,7 +84,6 @@ export class InkStrokeProperties { * @param control The list of all control points of the ink. */ @undoBatch - @action addPoints = (inkView: DocumentView, t: number, i: number, controls: { X: number; Y: number }[]) => { this.applyFunction(inkView, (view: DocumentView, ink: InkData) => { const doc = view.Document; @@ -95,7 +94,7 @@ export class InkStrokeProperties { // Updating the indices of the control points whose handle tangency has been broken. doc.brokenInkIndices = new List(Cast(doc.brokenInkIndices, listSpec('number'), []).map(control => (control > i ? control + 4 : control))); - this._currentPoint = -1; + runInAction(() => (this._currentPoint = -1)); return controls; }); @@ -155,7 +154,6 @@ export class InkStrokeProperties { * Deletes the current control point of the selected ink instance. */ @undoBatch - @action deletePoints = (inkView: DocumentView, preserve: boolean) => this.applyFunction( inkView, @@ -188,7 +186,7 @@ export class InkStrokeProperties { } } doc.brokenInkIndices = new List(brokenIndices.map(control => (control >= this._currentPoint ? control - 4 : control))); - this._currentPoint = -1; + runInAction(() => (this._currentPoint = -1)); return newPoints.length < 4 ? undefined : newPoints; }, true @@ -201,7 +199,6 @@ export class InkStrokeProperties { * @param scrpt The center point of the rotation in screen coordinates */ @undoBatch - @action rotateInk = (inkStrokes: DocumentView[], angle: number, scrpt: PointData) => { this.applyFunction(inkStrokes, (view: DocumentView, ink: InkData, xScale: number, yScale: number, inkStrokeWidth: number) => { const inkCenterPt = view.ComponentView?.ptFromScreen?.(scrpt); @@ -223,7 +220,6 @@ export class InkStrokeProperties { * @param scrpt The center point of the rotation in screen coordinates */ @undoBatch - @action stretchInk = (inkStrokes: DocumentView[], scaling: number, scrpt: PointData, scrVec: PointData, scaleUniformly: boolean) => { this.applyFunction(inkStrokes, (view: DocumentView, ink: InkData) => { const ptFromScreen = view.ComponentView?.ptFromScreen; @@ -244,7 +240,6 @@ export class InkStrokeProperties { * Handles the movement/scaling of a control point. */ @undoBatch - @action moveControlPtHandle = (inkView: DocumentView, deltaX: number, deltaY: number, controlIndex: number, origInk?: InkData) => this.applyFunction(inkView, (view: DocumentView, ink: InkData) => { const order = controlIndex % 4; @@ -457,7 +452,6 @@ export class InkStrokeProperties { * Handles the movement/scaling of a handle point. */ @undoBatch - @action moveTangentHandle = (inkView: DocumentView, deltaX: number, deltaY: number, handleIndex: number, oppositeHandleIndex: number, controlIndex: number) => this.applyFunction(inkView, (view: DocumentView, ink: InkData) => { const doc = view.Document; -- cgit v1.2.3-70-g09d2