Skip to content

Commit

Permalink
feat: 处理select-tool工具
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan Heng committed Jul 29, 2023
1 parent e3b052a commit 554cb31
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions packages/core/src/tools/ellipse-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export const ellipseTool = (): Tool => {
if (!ellipse) {
return;
}
app.select(ellipse);
app.setTool(selectTool());
app.setTool(selectTool(ellipse));
},
};
};
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/tools/line-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export const lineTool = (): Tool => {
if (!line) {
return;
}
app.select(line);
app.setTool(selectTool());
app.setTool(selectTool(line));
},
};
};
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/tools/rect-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export const rectTool = (): Tool => {
if (!rectangle) {
return;
}
app.select(rectangle);
app.setTool(selectTool());
app.setTool(selectTool(rectangle));
},
};
};
Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/tools/select-tool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Tool } from '../types';
import { ChildType, Tool } from '../types';

export const selectTool = (): Tool => {
export const selectTool = (...shapes: ChildType[]): Tool => {
return {
name: 'selectTool',
onActive() {},
onActive(app) {
app.select(...shapes);
},
onInactive() {},
onMouseDown() {},
};
Expand Down

0 comments on commit 554cb31

Please sign in to comment.