Permalink
Browse files

fix CVWidget slider connection/disconnection

a CVWidget2D consists of 2 sliders: a 2D slider and a range slider.
Hence, while connecting or disconnecting we must iterate over both.

Signed-off-by: Stefan Nussbaumer <st9fan@gmail.com>
  • Loading branch information...
nuss committed Jun 2, 2017
1 parent 0fab4c4 commit 30d09c7712c2d28b5c870ac3913037bec42e4275
Showing with 12 additions and 2 deletions.
  1. +12 −2 CVCenter/CVWidget.sc
View
@@ -3060,7 +3060,15 @@ CVWidget {
switch(this.class,
CVWidget2D, {
[this.slider2d, this.rangeSlider].do({ |view|
sliderConnection = [widgetCV.lo, widgetCV.hi].cvWidgetConnect(view);
sliderConnection ?? { sliderConnection = () };
switch (view.class,
Slider2D, {
sliderConnection.put(\td, [widgetCV.lo, widgetCV.hi].cvWidgetConnect(view));
},
RangeSlider, {
sliderConnection.put(\rs, [widgetCV.lo, widgetCV.hi].cvWidgetConnect(view));
}
)
})
},
CVWidgetMS, {
@@ -3077,7 +3085,9 @@ CVWidget {
}, {
// disconnect sliders
if(this.class == CVWidget2D, {
[widgetCV.lo, widgetCV.hi].cvWidgetDisconnect(sliderConnection);
sliderConnection.keysDo { |k|
[widgetCV.lo, widgetCV.hi].cvWidgetDisconnect(sliderConnection[k]);
}
}, {
widgetCV.cvWidgetDisconnect(sliderConnection);
});

0 comments on commit 30d09c7

Please sign in to comment.