Skip to content

Commit fc14480

Browse files
committed
🐞 fix: Fix the selection bug
1 parent 3593646 commit fc14480

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

packages/chili/src/commands/boolean.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export abstract class BooleanOperate extends CreateCommand {
3333
protected override getSteps(): IStep[] {
3434
return [
3535
new SelectModelStep("prompt.select.shape", false),
36-
new SelectModelStep("prompt.select.shape", false),
36+
new SelectModelStep("prompt.select.shape", false, {
37+
allow: (shape) => {
38+
return !this.stepDatas[0].models?.map((x) => x.shape()).includes(shape);
39+
},
40+
}),
3741
];
3842
}
3943
}

packages/chili/src/commands/create/converter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export class ConvertToWire extends CreateCommand {
2222
return new GeometryModel(this.document, `Wire ${count++}`, wireBody);
2323
}
2424

25+
protected override shouldClearSelectedBeforeExcute() {
26+
return false;
27+
}
28+
2529
protected override getSteps(): IStep[] {
2630
return [
2731
new SelectModelStep("prompt.select.edges", true, {
@@ -47,6 +51,10 @@ export class ConvertToFace extends CreateCommand {
4751
return new GeometryModel(this.document, `Face ${count++}`, wireBody);
4852
}
4953

54+
protected override shouldClearSelectedBeforeExcute() {
55+
return false;
56+
}
57+
5058
protected override getSteps(): IStep[] {
5159
return [
5260
new SelectModelStep("prompt.select.edges", true, {

packages/chili/src/commands/create/createCommand.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ export abstract class CreateCommand extends MultistepCommand {
1414

1515
protected abstract create(): GeometryModel;
1616

17+
protected shouldClearSelectedBeforeExcute() {
18+
return true;
19+
}
20+
1721
protected override beforeExecute(): Promise<boolean> {
18-
this.document.selection.clearSelected();
22+
if (this.shouldClearSelectedBeforeExcute()) {
23+
this.document.selection.clearSelected();
24+
}
1925
return super.beforeExecute();
2026
}
2127
}

0 commit comments

Comments
 (0)