Skip to content

Commit

Permalink
generalize zoom synchronization;
Browse files Browse the repository at this point in the history
pan2Dxyzmm for
middle and right mouse button drags are synchronized
  • Loading branch information
korbinian90 committed Nov 8, 2023
1 parent 67b5084 commit 6a77332
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions niivue/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,15 @@ class ExtendedNiivue extends Niivue {
constructor(opts: any) {
super(opts)
}
dragForSlicer3D(startXYendXY: number[]) {
this.canvas.focus()
super.dragForSlicer3D(startXYendXY)
this.otherNV.forEach((nv: Niivue) => {
nv.uiData.pan2Dxyzmm[0] = this.uiData.pan2Dxyzmm[0]
nv.uiData.pan2Dxyzmm[1] = this.uiData.pan2Dxyzmm[1]
nv.uiData.pan2Dxyzmm[2] = this.uiData.pan2Dxyzmm[2]
nv.uiData.pan2Dxyzmm[3] = this.uiData.pan2Dxyzmm[3]
nv.drawScene()
})
mouseMoveListener(e: MouseEvent) {
super.mouseMoveListener(e)
if (this.uiData.mouseButtonRightDown || this.uiData.mouseButtonCenterDown) {
this.canvas.focus()
this.otherNV.forEach((nv: Niivue) => {
nv.uiData.pan2Dxyzmm = this.uiData.pan2Dxyzmm.slice()
nv.drawScene()
})
}
}
}

Expand Down

0 comments on commit 6a77332

Please sign in to comment.