Skip to content

Commit 0d0819b

Browse files
committed
🚸 优化调整笔刷粗细的过程
1 parent 216d6df commit 0d0819b

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

app/src/core/service/controlService/controller/concrete/ControllerPenStrokeDrawing.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import { PenStroke, PenStrokeSegment } from "../../../../stage/stageObject/entit
88
import { Settings } from "../../../Settings";
99
import { Controller } from "../Controller";
1010
import { ControllerClass } from "../ControllerClass";
11-
import { Stage } from "../../../../stage/Stage";
12-
import { LineEffect } from "../../../feedbackService/effectEngine/concrete/LineEffect";
13-
1411
/**
1512
* 涂鸦功能
1613
*/
@@ -112,12 +109,10 @@ class ControllerDrawingClass extends ControllerClass {
112109
private onMouseMoveWhenAdjusting = (event: MouseEvent) => {
113110
// 更改宽度,检测鼠标上下移动的距离(模仿PS的笔刷粗细调整)
114111
const worldLocation = Renderer.transformView2World(new Vector(event.clientX, event.clientY));
115-
const delta = worldLocation.y - this.startAdjustWidthLocation.y;
116-
Stage.effectMachine.addEffect(LineEffect.default(this.startAdjustWidthLocation, worldLocation.clone()));
117-
if (delta > 0) {
118-
this.currentStrokeWidth = Math.min(Math.round(delta), 1000);
119-
} else if (delta < 0) {
120-
this.currentStrokeWidth = Math.max(Math.round(delta), 1);
112+
const delta = this.startAdjustWidthLocation.distance(worldLocation);
113+
// Stage.effectMachine.addEffect(LineEffect.default(this.startAdjustWidthLocation, worldLocation.clone()));
114+
if (delta > 1) {
115+
this.currentStrokeWidth = Math.min(Math.round(delta * 2), 1000);
121116
}
122117
};
123118

0 commit comments

Comments
 (0)