@@ -191,8 +191,14 @@ def __init__(self):
191191 super ().__init__ (** to_kwargs ("adjust-databounds" ))
192192
193193 with self :
194- v3 .VIcon ("mdi-web" , classes = "pl-6 opacity-50" )
195- with v3 .VRow (classes = "ma-0 px-2 align-center" ):
194+ v3 .VIcon (
195+ "mdi-web" ,
196+ classes = "pl-6 opacity-50" ,
197+ click = "crop_slider_edit = !crop_slider_edit" ,
198+ )
199+ with v3 .VRow (
200+ classes = "ma-0 px-2 align-center" , v_if = ("crop_slider_edit" , True )
201+ ):
196202 with v3 .VCol (cols = 6 ):
197203 with v3 .VRow (classes = "mx-2 my-0" ):
198204 v3 .VLabel (
@@ -231,6 +237,74 @@ def __init__(self):
231237 density = "compact" ,
232238 hide_details = True ,
233239 )
240+ with v3 .VRow (classes = "ma-0 pl-6 pr-2 align-center ga-4" , v_else = True ):
241+ v3 .VNumberInput (
242+ label = "Longitude (min)" ,
243+ v_model = ("crop_longitude_min" , - 180 ),
244+ min = [- 180 ],
245+ max = ("crop_longitude_max" , 180 ),
246+ step = [1 ],
247+ hide_details = True ,
248+ density = "comfortable" ,
249+ variant = "plain" ,
250+ flat = True ,
251+ control_variant = "stacked" ,
252+ )
253+ v3 .VNumberInput (
254+ label = "Longitude (max)" ,
255+ v_model = ("crop_longitude_max" , 180 ),
256+ min = ("crop_longitude_min" , - 180 ),
257+ max = [180 ],
258+ step = [1 ],
259+ hide_details = True ,
260+ density = "comfortable" ,
261+ variant = "plain" ,
262+ flat = True ,
263+ control_variant = "stacked" ,
264+ inset = True ,
265+ )
266+ v3 .VNumberInput (
267+ label = "Latitude (min)" ,
268+ v_model = ("crop_latitude_min" , - 90 ),
269+ min = [- 90 ],
270+ max = ("crop_latitude_max" , 90 ),
271+ step = [1 ],
272+ hide_details = True ,
273+ density = "comfortable" ,
274+ variant = "plain" ,
275+ flat = True ,
276+ control_variant = "stacked" ,
277+ inset = True ,
278+ )
279+ v3 .VNumberInput (
280+ label = "Latitude (max)" ,
281+ v_model = ("crop_latitude_max" , 90 ),
282+ min = ("crop_latitude_min" , - 90 ),
283+ max = [90 ],
284+ step = [1 ],
285+ hide_details = True ,
286+ density = "comfortable" ,
287+ variant = "plain" ,
288+ flat = True ,
289+ control_variant = "stacked" ,
290+ inset = True ,
291+ )
292+
293+ @change ("crop_longitude_min" , "crop_longitude_max" )
294+ def _on_crop_lon (self , crop_longitude_min , crop_longitude_max , ** _ ):
295+ if crop_longitude_min is None or crop_longitude_max is None :
296+ return
297+ data_range = [float (crop_longitude_min ), float (crop_longitude_max )]
298+ if data_range [0 ] < data_range [1 ]:
299+ self .state .crop_longitude = data_range
300+
301+ @change ("crop_latitude_min" , "crop_latitude_max" )
302+ def _on_crop_lat (self , crop_latitude_min , crop_latitude_max , ** _ ):
303+ if crop_latitude_min is None or crop_latitude_max is None :
304+ return
305+ data_range = [float (crop_latitude_min ), float (crop_latitude_max )]
306+ if data_range [0 ] < data_range [1 ]:
307+ self .state .crop_latitude = data_range
234308
235309
236310class DataSelection (html .Div ):
0 commit comments