Skip to content

Commit 416a5b8

Browse files
committed
🐛 涂鸦对象不参与对齐
1 parent c68ee24 commit 416a5b8

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ ControllerEntityClickSelectAndMove.mousemove = (event: MouseEvent) => {
9696
StageManager.moveConnectableEntitiesWithChildren(diffLocation);
9797
} else {
9898
StageEntityMoveManager.moveSelectedEntities(diffLocation);
99-
// StageManager.moveSelectedTextNodes(diffLocation);
100-
// StageManager.moveSelectedSections(diffLocation);
101-
// StageManager.moveSelectedConnectPoints(diffLocation);
102-
// StageManager.moveSelectedImageNodes(diffLocation);
103-
// StageManager.moveSelectedUrlNodes(diffLocation);
104-
// StageManager.moveSelectedPortalNodes(diffLocation);
105-
// StageManager.moveSelectedPenStrokes(diffLocation);
10699
}
107100

108101
// 预瞄反馈

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Vector } from "../../../../dataStruct/Vector";
22
import { Renderer } from "../../../../render/canvas2d/renderer";
3+
import { Stage } from "../../../../stage/Stage";
34
import { StageManager } from "../../../../stage/stageManager/StageManager";
45
import { ControllerClass } from "../ControllerClass";
56

@@ -9,6 +10,9 @@ import { ControllerClass } from "../ControllerClass";
910
export class ControllerPenStrokeControl extends ControllerClass {
1011
// 检查鼠标是否悬浮在笔迹上
1112
public mousemove: (event: MouseEvent) => void = (event) => {
13+
if (Stage.drawingMachine.isUsing) {
14+
return;
15+
}
1216
const location = Renderer.transformView2World(new Vector(event.clientX, event.clientY));
1317
for (const node of StageManager.getPenStrokes()) {
1418
node.isMouseHover = false;

app/src/core/stage/stageManager/concreteMethods/StageAutoAlignManager.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export namespace StageAutoAlignManager {
2828
.filter((entity) => !entity.isSelected)
2929
.filter((entity) => entity.collisionBox.getRectangle().isAbsoluteIn(viewRectangle));
3030
for (const selectedEntity of selectedEntities) {
31+
if (selectedEntity.isAlignExcluded) {
32+
// 涂鸦对象不参与对齐
33+
continue;
34+
}
35+
console.log(selectedEntity);
3136
onEntityMoveAlignToOtherEntity(selectedEntity, otherEntities);
3237
}
3338
}
@@ -43,6 +48,10 @@ export namespace StageAutoAlignManager {
4348
.filter((entity) => !entity.isSelected)
4449
.filter((entity) => entity.collisionBox.getRectangle().isAbsoluteIn(viewRectangle));
4550
for (const selectedEntity of selectedEntities) {
51+
if (selectedEntity.isAlignExcluded) {
52+
// 涂鸦对象不参与对齐
53+
continue;
54+
}
4655
onEntityMoveAlignToOtherEntity(selectedEntity, otherEntities, true);
4756
}
4857
}

app/src/core/stage/stageObject/abstract/StageEntity.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export abstract class Entity extends StageObject {
1414
*/
1515
abstract move(delta: Vector): void;
1616

17+
/**
18+
* 是否忽略自动对齐功能
19+
* 例如涂鸦就不吸附对齐
20+
*/
21+
public isAlignExcluded = false;
1722
/**
1823
* 将某个物体移动到某个位置
1924
* 注意:看的是最小外接矩形的左上角位置,不是中心位置

app/src/core/stage/stageObject/entity/PenStroke.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class PenStrokeSegment {
1818
}
1919

2020
export class PenStroke extends Entity {
21+
/** 涂鸦不参与吸附对齐 */
22+
public isAlignExcluded: boolean = true;
23+
2124
public isHiddenBySectionCollapse: boolean = false;
2225
collisionBox: CollisionBox = new CollisionBox([]);
2326
public uuid: string;

0 commit comments

Comments
 (0)