@@ -139,28 +139,33 @@ def getSeedState(self):
139139# Control UI
140140# -----------------------------------------------------------------------------
141141
142+ high = 0.6
143+ low = - 0.55
144+
142145controls = [
143146 dbc .Card (
144147 [
145148 dbc .CardHeader ("Seeds" ),
146149 dbc .CardBody (
147150 [
148- html .P ("Seed line :" ),
151+ html .P ("Line seed position (from bottom) :" ),
149152 dcc .Slider (
150153 id = "point-1" ,
151- min = - 1 ,
152- max = 1 ,
153- step = 0.01 ,
154+ min = low ,
155+ max = high ,
156+ step = 0.05 ,
154157 value = 0 ,
155- marks = {- 1 : "-1" , 1 : "+1" },
158+ marks = {low : str ( low ), high : str ( high ) },
156159 ),
160+ html .Br (),
161+ html .P ("Line seed position (from top):" ),
157162 dcc .Slider (
158163 id = "point-2" ,
159- min = - 1 ,
160- max = 1 ,
161- step = 0.01 ,
164+ min = low ,
165+ max = high ,
166+ step = 0.05 ,
162167 value = 0 ,
163- marks = {- 1 : "-1" , 1 : "+1" },
168+ marks = {low : str ( low ), high : str ( high ) },
164169 ),
165170 html .Br (),
166171 html .P ("Line resolution:" ),
@@ -244,14 +249,28 @@ def getSeedState(self):
244249 Output ("vtk-view" , "triggerRender" ),
245250 ],
246251 [
252+ Input ("point-1" , "drag_value" ),
253+ Input ("point-2" , "drag_value" ),
247254 Input ("point-1" , "value" ),
248255 Input ("point-2" , "value" ),
249256 Input ("seed-resolution" , "value" ),
250257 Input ("color-by" , "value" ),
251258 Input ("preset" , "value" ),
252259 ],
253260)
254- def update_seeds (y1 , y2 , resolution , colorByField , presetName ):
261+ def update_seeds (y1_drag , y2_drag , y1 , y2 , resolution , colorByField , presetName ):
262+ triggered = dash .callback_context .triggered
263+
264+ if triggered and "drag_value" in triggered [0 ]["prop_id" ]:
265+ viz .updateSeedPoints (y1_drag , y2_drag , resolution )
266+ return [
267+ viz .getSeedState (),
268+ dash .no_update ,
269+ dash .no_update ,
270+ dash .no_update ,
271+ random .random (), # trigger a render
272+ ]
273+
255274 viz .updateSeedPoints (y1 , y2 , resolution )
256275 return [
257276 viz .getSeedState (),
0 commit comments