Skip to content

Commit

Permalink
Fix the issue where selecting another operator was not possible after…
Browse files Browse the repository at this point in the history
… deleting a selected operator in the workspace (#3284)

### Purpose:
Currently, after deleting an operator with detail buttons open,
attempting to open the detail buttons of another operator results in a
missing attr issue. The root cause is that the previous implementation
did not account for the attr disappearing after the operator was
deleted.

### Changes:
Add a check for currentOpenOperatorId; if the ID does not exist, no
operation will be performed.

### Demos:
Before:


https://github.com/user-attachments/assets/a1f325db-f14a-42fd-a022-79c4e2e0129e


After:


https://github.com/user-attachments/assets/1338fa11-989a-4ee4-8b48-02ccc02a82a8
  • Loading branch information
GspikeHalo authored Mar 2, 2025
1 parent ee4f174 commit de81a68
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -758,30 +758,35 @@ export class WorkflowEditorComponent implements AfterViewInit, OnDestroy {
fromJointPaperEvent(this.paper, "element:pointerdown")
.pipe(untilDestroyed(this))
.subscribe(event => {
if (this.currentOpenedOperatorID !== null) {
const operatorID = event[0].model.id.toString();

if (this.currentOpenedOperatorID !== null && this.paper.getModelById(this.currentOpenedOperatorID)) {
this.jointUIService.foldOperatorDetails(this.paper, this.currentOpenedOperatorID);
}

this.currentOpenedOperatorID = event[0].model.id.toString();
this.jointUIService.unfoldOperatorDetails(this.paper, this.currentOpenedOperatorID);
this.currentOpenedOperatorID = operatorID;
this.jointUIService.unfoldOperatorDetails(this.paper, operatorID);
});

fromJointPaperEvent(this.paper, "element:contextmenu")
.pipe(untilDestroyed(this))
.subscribe(event => {
if (this.currentOpenedOperatorID !== null) {
const operatorID = event[0].model.id.toString();

if (this.currentOpenedOperatorID !== null && this.paper.getModelById(this.currentOpenedOperatorID)) {
this.jointUIService.foldOperatorDetails(this.paper, this.currentOpenedOperatorID);
}

this.currentOpenedOperatorID = event[0].model.id.toString();
this.jointUIService.unfoldOperatorDetails(this.paper, event[0].model.id.toString());
this.currentOpenedOperatorID = operatorID;
this.jointUIService.unfoldOperatorDetails(this.paper, operatorID);
});

fromJointPaperEvent(this.paper, "blank:pointerdown")
.pipe(untilDestroyed(this))
.subscribe(() => {
if (this.currentOpenedOperatorID !== null) {
if (this.currentOpenedOperatorID !== null && this.paper.getModelById(this.currentOpenedOperatorID)) {
this.jointUIService.foldOperatorDetails(this.paper, this.currentOpenedOperatorID);
this.currentOpenedOperatorID = null;
}
});
}
Expand Down

0 comments on commit de81a68

Please sign in to comment.