Skip to content

Commit

Permalink
[desktop]: Handle guide output attachment on Alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Oct 23, 2023
1 parent f44bf97 commit 9eeabd4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions desktop/src/app/alignment/alignment.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ export class AlignmentComponent implements AfterViewInit, OnDestroy {
}
})

electron.on('GUIDE_OUTPUT_ATTACHED', (_, event: GuideOutput) => {
ngZone.run(() => {
this.guideOutputs.push(event)
})
})

electron.on('GUIDE_OUTPUT_DETACHED', (_, event: GuideOutput) => {
ngZone.run(() => {
const index = this.guideOutputs.findIndex(e => e.name === event.name)
if (index >= 0) this.guideOutputs.splice(index, 1)
})
})

electron.on('GUIDE_OUTPUT_UPDATED', (_, event: GuideOutput) => {
if (event.name === this.guideOutput?.name) {
ngZone.run(() => {
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/app/guider/guider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class GuiderComponent implements AfterViewInit, OnDestroy {
electron.on('GUIDE_OUTPUT_DETACHED', (_, event: GuideOutput) => {
ngZone.run(() => {
const index = this.guideOutputs.findIndex(e => e.name === event.name)
if (index) this.guideOutputs.splice(index, 1)
if (index >= 0) this.guideOutputs.splice(index, 1)
})
})

Expand Down

0 comments on commit 9eeabd4

Please sign in to comment.