Skip to content

Commit

Permalink
BUG: Do not subscribe to blend mode changed with 2D images
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jan 15, 2020
1 parent ec066cd commit 7356aa6
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions js/lib/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,32 +585,32 @@ const ViewerView = widgets.DOMWidgetView.extend({
}
this.model.itkVtkViewer.subscribeToggleCroppingPlanes(onToggleCroppingPlanes)

const onBlendModeChanged = (blend) => {
let pythonMode = null
switch(blend) {
case 0:
pythonMode = 'composite'
break
case 1:
pythonMode = 'max'
break
case 2:
pythonMode = 'min'
break
case 3:
pythonMode = 'average'
break
default:
throw new Error('Unknown blend mode')
}
if (pythonMode !== this.model.get('blend')) {
this.model.set('blend', pythonMode)
this.model.save_changes()
if (!this.model.use2D) {
const onBlendModeChanged = (blend) => {
let pythonMode = null
switch(blend) {
case 0:
pythonMode = 'composite'
break
case 1:
pythonMode = 'max'
break
case 2:
pythonMode = 'min'
break
case 3:
pythonMode = 'average'
break
default:
throw new Error('Unknown blend mode')
}
if (pythonMode !== this.model.get('blend')) {
this.model.set('blend', pythonMode)
this.model.save_changes()
}
}
}
this.model.itkVtkViewer.subscribeBlendModeChanged(onBlendModeChanged)
this.model.itkVtkViewer.subscribeBlendModeChanged(onBlendModeChanged)

if (!this.model.use2D) {
const onViewModeChanged = (mode) => {
let pythonMode = null;
switch (mode) {
Expand Down

0 comments on commit 7356aa6

Please sign in to comment.