1- import asyncio
21from dataclasses import field
32from typing import Optional
43
@@ -155,7 +154,7 @@ class Map(ft.ConstrainedControl):
155154 Fires when a pointer up event occurs.
156155 """
157156
158- async def rotate_from_async (
157+ async def rotate_from (
159158 self ,
160159 degree : ft .Number ,
161160 animation_curve : Optional [ft .AnimationCurve ] = None ,
@@ -174,7 +173,7 @@ async def rotate_from_async(
174173 cancel_ongoing_animations: Whether to cancel/stop all
175174 ongoing map-animations before starting this new one.
176175 """
177- await self ._invoke_method_async (
176+ await self ._invoke_method (
178177 method_name = "rotate_from" ,
179178 arguments = {
180179 "degree" : degree ,
@@ -184,35 +183,7 @@ async def rotate_from_async(
184183 },
185184 )
186185
187- def rotate_from (
188- self ,
189- degree : ft .Number ,
190- animation_curve : Optional [ft .AnimationCurve ] = None ,
191- animation_duration : Optional [ft .DurationValue ] = None ,
192- cancel_ongoing_animations : bool = False ,
193- ) -> None :
194- """
195- Applies a rotation of `degree` to the current rotation.
196-
197- Args:
198- degree: The number of degrees to increment to the current rotation.
199- animation_curve: The curve of the animation. If None (the default),
200- [`Map.animation_curve`][(p).] will be used.
201- animation_duration: The duration of the animation.
202- If None (the default), [`Map.animation_duration`][(p).] will be used.
203- cancel_ongoing_animations: Whether to cancel/stop all
204- ongoing map-animations before starting this new one.
205- """
206- asyncio .create_task (
207- self .rotate_from_async (
208- degree = degree ,
209- animation_curve = animation_curve ,
210- animation_duration = animation_duration ,
211- cancel_ongoing_animations = cancel_ongoing_animations ,
212- )
213- )
214-
215- async def reset_rotation_async (
186+ async def reset_rotation (
216187 self ,
217188 animation_curve : Optional [ft .AnimationCurve ] = None ,
218189 animation_duration : Optional [ft .DurationValue ] = None ,
@@ -229,7 +200,7 @@ async def reset_rotation_async(
229200 cancel_ongoing_animations: Whether to cancel/stop all
230201 ongoing map-animations before starting this new one.
231202 """
232- await self ._invoke_method_async (
203+ await self ._invoke_method (
233204 method_name = "reset_rotation" ,
234205 arguments = {
235206 "curve" : animation_curve or self .animation_curve ,
@@ -238,32 +209,7 @@ async def reset_rotation_async(
238209 },
239210 )
240211
241- def reset_rotation (
242- self ,
243- animation_curve : Optional [ft .AnimationCurve ] = None ,
244- animation_duration : ft .DurationValue = None ,
245- cancel_ongoing_animations : bool = False ,
246- ) -> None :
247- """
248- Resets the map's rotation to 0 degrees.
249-
250- Args:
251- animation_curve: The curve of the animation. If None (the default),
252- [`Map.animation_curve`][(p).] will be used.
253- animation_duration: The duration of the animation.
254- If None (the default), [`Map.animation_duration`][(p).] will be used.
255- cancel_ongoing_animations: Whether to cancel/stop all
256- ongoing map-animations before starting this new one.
257- """
258- asyncio .create_task (
259- self .reset_rotation_async (
260- animation_curve = animation_curve ,
261- animation_duration = animation_duration ,
262- cancel_ongoing_animations = cancel_ongoing_animations ,
263- )
264- )
265-
266- async def zoom_in_async (
212+ async def zoom_in (
267213 self ,
268214 animation_curve : Optional [ft .AnimationCurve ] = None ,
269215 animation_duration : Optional [ft .DurationValue ] = None ,
@@ -280,7 +226,7 @@ async def zoom_in_async(
280226 cancel_ongoing_animations: Whether to cancel/stop all
281227 ongoing map-animations before starting this new one.
282228 """
283- await self ._invoke_method_async (
229+ await self ._invoke_method (
284230 method_name = "zoom_in" ,
285231 arguments = {
286232 "curve" : animation_curve or self .animation_curve ,
@@ -289,32 +235,7 @@ async def zoom_in_async(
289235 },
290236 )
291237
292- def zoom_in (
293- self ,
294- animation_curve : Optional [ft .AnimationCurve ] = None ,
295- animation_duration : Optional [ft .DurationValue ] = None ,
296- cancel_ongoing_animations : bool = False ,
297- ) -> None :
298- """
299- Zooms in by one zoom-level from the current one.
300-
301- Args:
302- animation_curve: The curve of the animation. If None (the default),
303- [`Map.animation_curve`][(p).] will be used.
304- animation_duration: The duration of the animation.
305- If None (the default), [`Map.animation_duration`][(p).] will be used.
306- cancel_ongoing_animations: Whether to cancel/stop all
307- ongoing map-animations before starting this new one.
308- """
309- asyncio .create_task (
310- self .zoom_in_async (
311- animation_curve = animation_curve ,
312- animation_duration = animation_duration ,
313- cancel_ongoing_animations = cancel_ongoing_animations ,
314- )
315- )
316-
317- async def zoom_out_async (
238+ async def zoom_out (
318239 self ,
319240 animation_curve : Optional [ft .AnimationCurve ] = None ,
320241 animation_duration : Optional [ft .DurationValue ] = None ,
@@ -331,7 +252,7 @@ async def zoom_out_async(
331252 cancel_ongoing_animations: Whether to cancel/stop all
332253 ongoing map-animations before starting this new one.
333254 """
334- await self ._invoke_method_async (
255+ await self ._invoke_method (
335256 method_name = "zoom_out" ,
336257 arguments = {
337258 "curve" : animation_curve or self .animation_curve ,
@@ -340,32 +261,7 @@ async def zoom_out_async(
340261 },
341262 )
342263
343- def zoom_out (
344- self ,
345- animation_curve : Optional [ft .AnimationCurve ] = None ,
346- animation_duration : Optional [ft .DurationValue ] = None ,
347- cancel_ongoing_animations : bool = False ,
348- ) -> None :
349- """
350- Zooms out by one zoom-level from the current one.
351-
352- Args:
353- animation_curve: The curve of the animation. If None (the default),
354- [`Map.animation_curve`][(p).] will be used.
355- animation_duration: The duration of the animation.
356- If None (the default), [`Map.animation_duration`][(p).] will be used.
357- cancel_ongoing_animations: Whether to cancel/stop all
358- ongoing map-animations before starting this new one.
359- """
360- asyncio .create_task (
361- self .zoom_out_async (
362- animation_curve = animation_curve ,
363- animation_duration = animation_duration ,
364- cancel_ongoing_animations = cancel_ongoing_animations ,
365- )
366- )
367-
368- async def zoom_to_async (
264+ async def zoom_to (
369265 self ,
370266 zoom : ft .Number ,
371267 animation_curve : Optional [ft .AnimationCurve ] = None ,
@@ -384,7 +280,7 @@ async def zoom_to_async(
384280 cancel_ongoing_animations: Whether to cancel/stop all
385281 ongoing map-animations before starting this new one.
386282 """
387- await self ._invoke_method_async (
283+ await self ._invoke_method (
388284 method_name = "zoom_to" ,
389285 arguments = {
390286 "zoom" : zoom ,
@@ -394,35 +290,7 @@ async def zoom_to_async(
394290 },
395291 )
396292
397- def zoom_to (
398- self ,
399- zoom : ft .Number ,
400- animation_curve : Optional [ft .AnimationCurve ] = None ,
401- animation_duration : Optional [ft .DurationValue ] = None ,
402- cancel_ongoing_animations : bool = False ,
403- ) -> None :
404- """
405- Zoom the map to a specific zoom level.
406-
407- Args:
408- zoom: The zoom level to zoom to.
409- animation_curve: The curve of the animation. If None (the default),
410- [`Map.animation_curve`][(p).] will be used.
411- animation_duration: The duration of the animation.
412- If None (the default), [`Map.animation_duration`][(p).] will be used.
413- cancel_ongoing_animations: Whether to cancel/stop all
414- ongoing map-animations before starting this new one.
415- """
416- asyncio .create_task (
417- self .zoom_to_async (
418- zoom = zoom ,
419- animation_curve = animation_curve ,
420- animation_duration = animation_duration ,
421- cancel_ongoing_animations = cancel_ongoing_animations ,
422- )
423- )
424-
425- async def move_to_async (
293+ async def move_to (
426294 self ,
427295 destination : Optional [MapLatitudeLongitude ] = None ,
428296 zoom : Optional [ft .Number ] = None ,
@@ -454,7 +322,7 @@ async def move_to_async(
454322 assert zoom is None or zoom >= 0 , (
455323 f"zoom must be greater than or equal to zero, got { zoom } "
456324 )
457- await self ._invoke_method_async (
325+ await self ._invoke_method (
458326 method_name = "move_to" ,
459327 arguments = {
460328 "destination" : destination ,
@@ -467,48 +335,7 @@ async def move_to_async(
467335 },
468336 )
469337
470- def move_to (
471- self ,
472- destination : Optional [MapLatitudeLongitude ] = None ,
473- zoom : Optional [ft .Number ] = None ,
474- rotation : Optional [ft .Number ] = None ,
475- animation_curve : Optional [ft .AnimationCurve ] = None ,
476- animation_duration : Optional [ft .DurationValue ] = None ,
477- offset : ft .OffsetValue = ft .Offset (0 , 0 ),
478- cancel_ongoing_animations : bool = False ,
479- ) -> None :
480- """
481- Moves to a specific location.
482-
483- Args:
484- destination: The destination point to move to.
485- zoom: The zoom level to be applied. If provided,
486- must be greater than or equal to `0.0`.
487- rotation: Rotation (in degrees) to be applied.
488- offset: The offset to be used. Only works when `rotation` is `None`.
489- animation_curve: The curve of the animation. If None (the default),
490- [`Map.animation_curve`][(p).] will be used.
491- animation_duration: The duration of the animation.
492- If None (the default), [`Map.animation_duration`][(p).] will be used.
493- cancel_ongoing_animations: Whether to cancel/stop all
494- ongoing map-animations before starting this new one.
495-
496- Raises:
497- AssertionError: If `zoom` is not `None` and is negative.
498- """
499- asyncio .create_task (
500- self .move_to_async (
501- destination = destination ,
502- zoom = zoom ,
503- rotation = rotation ,
504- animation_curve = animation_curve ,
505- animation_duration = animation_duration ,
506- offset = offset ,
507- cancel_ongoing_animations = cancel_ongoing_animations ,
508- )
509- )
510-
511- async def center_on_async (
338+ async def center_on (
512339 self ,
513340 point : MapLatitudeLongitude ,
514341 zoom : Optional [ft .Number ],
@@ -522,14 +349,14 @@ async def center_on_async(
522349 Args:
523350 point: The point on which to center the map.
524351 zoom: The zoom level to be applied.
525- animation_curve: The curve of the animation. If None (the default),
352+ animation_curve: The curve of the animation. If ` None` (the default),
526353 [`Map.animation_curve`][(p).] will be used.
527354 animation_duration: The duration of the animation.
528355 If None (the default), [`Map.animation_duration`][(p).] will be used.
529356 cancel_ongoing_animations: Whether to cancel/stop all
530357 ongoing map-animations before starting this new one.
531358 """
532- await self ._invoke_method_async (
359+ await self ._invoke_method (
533360 method_name = "center_on" ,
534361 arguments = {
535362 "point" : point ,
@@ -539,34 +366,3 @@ async def center_on_async(
539366 "cancel_ongoing_animations" : cancel_ongoing_animations ,
540367 },
541368 )
542-
543- def center_on (
544- self ,
545- point : Optional [MapLatitudeLongitude ],
546- zoom : Optional [ft .Number ],
547- animation_curve : Optional [ft .AnimationCurve ] = None ,
548- animation_duration : Optional [ft .DurationValue ] = None ,
549- cancel_ongoing_animations : bool = False ,
550- ) -> None :
551- """
552- Centers the map on the given point.
553-
554- Args:
555- point: The point on which to center the map.
556- zoom: The zoom level to be applied.
557- animation_curve: The curve of the animation. If None (the default),
558- [`Map.animation_curve`][(p).] will be used.
559- animation_duration: The duration of the animation.
560- If None (the default), [`Map.animation_duration`][(p).] will be used.
561- cancel_ongoing_animations: Whether to cancel/stop all
562- ongoing map-animations before starting this new one.
563- """
564- asyncio .create_task (
565- self .center_on_async (
566- point = point ,
567- zoom = zoom ,
568- animation_curve = animation_curve ,
569- animation_duration = animation_duration ,
570- cancel_ongoing_animations = cancel_ongoing_animations ,
571- )
572- )
0 commit comments