Skip to content

Commit

Permalink
feat(rect-tool): Support multiple select
Browse files Browse the repository at this point in the history
  • Loading branch information
lijingchi committed Feb 23, 2023
1 parent 3cb3c64 commit f62ab7e
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 115 deletions.
21 changes: 19 additions & 2 deletions packages/lb-annotation/src/core/toolOperation/Selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ class Selection {
* Update selectedIDs:
* Remove selectedID when selectedIDs includes
* Append selectedID when selectedIDs not includes
* SelectedID is
* @param selectedID
*/
public updateSelectedIDs(selectedID: SelectedID) {
public updateSelectedIDs(selectedID?: SelectedID) {
if (!selectedID) {
this._selectedIDs = [];
return;
}

if (this.selectedIDs.includes(selectedID)) {
this.selectedIDs = this.selectedIDs.filter((id) => id !== selectedID);
} else {
Expand All @@ -81,6 +87,17 @@ class Selection {
this.setResultAndRender(updatedDataList);
}

public updateSelectedGraphWithOffsetProps(offset: { x: number; num }) {
// this.dataList.map(i => {
// if (this.isIdSelected(i.id)) {
// return {
// ...i,
// i: i.x +=
// }
// }
// })
}

public selectAll() {
this.selectedIDs = this.visibleDataList.map((i) => i.id);
this.toolInstance.render();
Expand Down Expand Up @@ -118,7 +135,7 @@ class Selection {
// todo: Update tool instance and render
}

public isSelectedID(id: string) {
public isIdSelected(id: string) {
return this.selectedIDs.includes(id);
}
}
Expand Down
Loading

0 comments on commit f62ab7e

Please sign in to comment.