flet-map 0.2.0.dev46__py3-none-any.whl → 0.2.0.dev63__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flet-map might be problematic. Click here for more details.
- flet_map/__init__.py +54 -10
- flet_map/circle_layer.py +17 -13
- flet_map/map.py +90 -254
- flet_map/marker_layer.py +38 -25
- flet_map/polygon_layer.py +15 -14
- flet_map/polyline_layer.py +15 -12
- flet_map/rich_attribution.py +14 -11
- flet_map/simple_attribution.py +5 -7
- flet_map/source_attribution.py +12 -8
- flet_map/tile_layer.py +50 -40
- flet_map/types.py +218 -155
- {flet_map-0.2.0.dev46.dist-info → flet_map-0.2.0.dev63.dist-info}/METADATA +6 -4
- {flet_map-0.2.0.dev46.dist-info → flet_map-0.2.0.dev63.dist-info}/RECORD +19 -19
- flutter/flet_map/lib/src/utils/map.dart +4 -2
- flutter/flet_map/pubspec.lock +68 -44
- flutter/flet_map/pubspec.yaml +1 -1
- {flet_map-0.2.0.dev46.dist-info → flet_map-0.2.0.dev63.dist-info}/WHEEL +0 -0
- {flet_map-0.2.0.dev46.dist-info → flet_map-0.2.0.dev63.dist-info}/licenses/LICENSE +0 -0
- {flet_map-0.2.0.dev46.dist-info → flet_map-0.2.0.dev63.dist-info}/top_level.txt +0 -0
flet_map/map.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import asyncio
|
|
2
1
|
from dataclasses import field
|
|
3
2
|
from typing import Optional
|
|
4
3
|
|
|
5
4
|
import flet as ft
|
|
6
5
|
|
|
7
|
-
from .map_layer import MapLayer
|
|
8
|
-
from .types import (
|
|
6
|
+
from flet_map.map_layer import MapLayer
|
|
7
|
+
from flet_map.types import (
|
|
9
8
|
CameraFit,
|
|
10
9
|
InteractionConfiguration,
|
|
11
10
|
MapEvent,
|
|
@@ -22,14 +21,12 @@ __all__ = ["Map"]
|
|
|
22
21
|
@ft.control("Map")
|
|
23
22
|
class Map(ft.ConstrainedControl):
|
|
24
23
|
"""
|
|
25
|
-
An interactive map
|
|
24
|
+
An interactive map that displays various layers.
|
|
26
25
|
"""
|
|
27
26
|
|
|
28
27
|
layers: list[MapLayer]
|
|
29
28
|
"""
|
|
30
29
|
A list of layers to be displayed (stack-like) on the map.
|
|
31
|
-
|
|
32
|
-
Value is of type [`MapLayer`][(p).].
|
|
33
30
|
"""
|
|
34
31
|
|
|
35
32
|
initial_center: MapLatitudeLongitude = field(
|
|
@@ -37,8 +34,6 @@ class Map(ft.ConstrainedControl):
|
|
|
37
34
|
)
|
|
38
35
|
"""
|
|
39
36
|
The initial center of the map.
|
|
40
|
-
|
|
41
|
-
Value is of type `MapLatitudeLongitude`.
|
|
42
37
|
"""
|
|
43
38
|
|
|
44
39
|
initial_rotation: ft.Number = 0.0
|
|
@@ -48,7 +43,7 @@ class Map(ft.ConstrainedControl):
|
|
|
48
43
|
|
|
49
44
|
initial_zoom: ft.Number = 13.0
|
|
50
45
|
"""
|
|
51
|
-
The zoom when the map is first loaded.
|
|
46
|
+
The zoom when the map is first loaded.
|
|
52
47
|
If initial_camera_fit is defined this has no effect.
|
|
53
48
|
"""
|
|
54
49
|
|
|
@@ -67,113 +62,99 @@ class Map(ft.ConstrainedControl):
|
|
|
67
62
|
keep_alive: bool = False
|
|
68
63
|
"""
|
|
69
64
|
Whether to enable the built in keep-alive functionality.
|
|
70
|
-
|
|
71
|
-
If the map is within a complex layout, such as a `ListView
|
|
65
|
+
|
|
66
|
+
If the map is within a complex layout, such as a [`ListView`][flet.ListView],
|
|
72
67
|
the map will reset to it's inital position after it appears back into view.
|
|
73
68
|
To ensure this doesn't happen, enable this flag to prevent it from rebuilding.
|
|
74
69
|
"""
|
|
75
70
|
|
|
76
71
|
max_zoom: Optional[ft.Number] = None
|
|
77
72
|
"""
|
|
78
|
-
The maximum (highest) zoom level of every layer.
|
|
73
|
+
The maximum (highest) zoom level of every layer.
|
|
79
74
|
Each layer can specify additional zoom level restrictions.
|
|
80
75
|
"""
|
|
81
76
|
|
|
82
77
|
min_zoom: Optional[ft.Number] = None
|
|
83
78
|
"""
|
|
84
|
-
The minimum (smallest) zoom level of every layer.
|
|
79
|
+
The minimum (smallest) zoom level of every layer.
|
|
85
80
|
Each layer can specify additional zoom level restrictions.
|
|
86
81
|
"""
|
|
87
82
|
|
|
88
83
|
animation_curve: ft.AnimationCurve = ft.AnimationCurve.FAST_OUT_SLOWIN
|
|
89
84
|
"""
|
|
90
|
-
The default animation curve to be used for map-animations
|
|
91
|
-
when calling instance methods like `zoom_in()
|
|
85
|
+
The default animation curve to be used for map-animations
|
|
86
|
+
when calling instance methods like [`zoom_in()`][(c).zoom_in],
|
|
87
|
+
[`rotate_from()`][(c).rotate_from],
|
|
88
|
+
[`move_to()`][(c).move_to] etc.
|
|
92
89
|
"""
|
|
93
90
|
|
|
94
91
|
animation_duration: ft.DurationValue = field(
|
|
95
92
|
default_factory=lambda: ft.Duration(milliseconds=500)
|
|
96
93
|
)
|
|
97
94
|
"""
|
|
98
|
-
The default animation duration to be used for map-animations
|
|
99
|
-
when calling instance methods like `zoom_in()
|
|
95
|
+
The default animation duration to be used for map-animations
|
|
96
|
+
when calling instance methods like [`zoom_in()`][(c).zoom_in],
|
|
97
|
+
[`rotate_from()`][(c).rotate_from],
|
|
98
|
+
[`move_to()`][(c).move_to] etc.
|
|
100
99
|
"""
|
|
101
100
|
|
|
102
101
|
initial_camera_fit: Optional[CameraFit] = None
|
|
103
102
|
"""
|
|
104
|
-
Defines the visible bounds when the map is first loaded.
|
|
105
|
-
Takes precedence over `initial_center
|
|
103
|
+
Defines the visible bounds when the map is first loaded.
|
|
104
|
+
Takes precedence over [`initial_center`][..]/[`initial_zoom`][..].
|
|
106
105
|
"""
|
|
107
106
|
|
|
108
|
-
on_init: ft.
|
|
107
|
+
on_init: Optional[ft.ControlEventHandler["Map"]] = None
|
|
109
108
|
"""
|
|
110
109
|
Fires when the map is initialized.
|
|
111
110
|
"""
|
|
112
111
|
|
|
113
|
-
on_tap: ft.
|
|
112
|
+
on_tap: Optional[ft.EventHandler[MapTapEvent]] = None
|
|
114
113
|
"""
|
|
115
114
|
Fires when a tap event occurs.
|
|
116
|
-
|
|
117
|
-
Event handler argument is of type [`MapTapEvent`][(p).].
|
|
118
115
|
"""
|
|
119
116
|
|
|
120
|
-
on_hover: ft.
|
|
117
|
+
on_hover: Optional[ft.EventHandler[MapHoverEvent]] = None
|
|
121
118
|
"""
|
|
122
119
|
Fires when a hover event occurs.
|
|
123
|
-
|
|
124
|
-
Event handler argument is of type [`MapHoverEvent`][(p).].
|
|
125
120
|
"""
|
|
126
121
|
|
|
127
|
-
on_secondary_tap: ft.
|
|
122
|
+
on_secondary_tap: Optional[ft.EventHandler[MapTapEvent]] = None
|
|
128
123
|
"""
|
|
129
124
|
Fires when a secondary tap event occurs.
|
|
130
|
-
|
|
131
|
-
Event handler argument is of type [`MapTapEvent`][(p).].
|
|
132
125
|
"""
|
|
133
126
|
|
|
134
|
-
on_long_press: ft.
|
|
127
|
+
on_long_press: Optional[ft.EventHandler[MapTapEvent]] = None
|
|
135
128
|
"""
|
|
136
129
|
Fires when a long press event occurs.
|
|
137
|
-
|
|
138
|
-
Event handler argument is of type [`MapTapEvent`][(p).].
|
|
139
130
|
"""
|
|
140
131
|
|
|
141
|
-
on_event: ft.
|
|
132
|
+
on_event: Optional[ft.EventHandler[MapEvent]] = None
|
|
142
133
|
"""
|
|
143
134
|
Fires when any map events occurs.
|
|
144
|
-
|
|
145
|
-
Event handler argument is of type [`MapEvent`][(p).].
|
|
146
135
|
"""
|
|
147
136
|
|
|
148
|
-
on_position_change: ft.
|
|
137
|
+
on_position_change: Optional[ft.EventHandler[MapPositionChangeEvent]] = None
|
|
149
138
|
"""
|
|
150
139
|
Fires when the map position changes.
|
|
151
|
-
|
|
152
|
-
Event handler argument is of type [`MapPositionChangeEvent`][(p).].
|
|
153
140
|
"""
|
|
154
141
|
|
|
155
|
-
on_pointer_down: ft.
|
|
142
|
+
on_pointer_down: Optional[ft.EventHandler[MapPointerEvent]] = None
|
|
156
143
|
"""
|
|
157
144
|
Fires when a pointer down event occurs.
|
|
158
|
-
|
|
159
|
-
Event handler argument is of type [`MapPointerEvent`][(p).].
|
|
160
145
|
"""
|
|
161
146
|
|
|
162
|
-
on_pointer_cancel: ft.
|
|
147
|
+
on_pointer_cancel: Optional[ft.EventHandler[MapPointerEvent]] = None
|
|
163
148
|
"""
|
|
164
149
|
Fires when a pointer cancel event occurs.
|
|
165
|
-
|
|
166
|
-
Event handler argument is of type [`MapPointerEvent`][(p).].
|
|
167
150
|
"""
|
|
168
151
|
|
|
169
|
-
on_pointer_up: ft.
|
|
152
|
+
on_pointer_up: Optional[ft.EventHandler[MapPointerEvent]] = None
|
|
170
153
|
"""
|
|
171
154
|
Fires when a pointer up event occurs.
|
|
172
|
-
|
|
173
|
-
Event handler argument is of type [`MapPointerEvent`][(p).].
|
|
174
155
|
"""
|
|
175
156
|
|
|
176
|
-
async def
|
|
157
|
+
async def rotate_from(
|
|
177
158
|
self,
|
|
178
159
|
degree: ft.Number,
|
|
179
160
|
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
@@ -185,11 +166,14 @@ class Map(ft.ConstrainedControl):
|
|
|
185
166
|
|
|
186
167
|
Args:
|
|
187
168
|
degree: The number of degrees to increment to the current rotation.
|
|
188
|
-
animation_curve: The curve of the animation. If None (the default),
|
|
189
|
-
|
|
190
|
-
|
|
169
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
170
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
171
|
+
animation_duration: The duration of the animation.
|
|
172
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
173
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
174
|
+
ongoing map-animations before starting this new one.
|
|
191
175
|
"""
|
|
192
|
-
await self.
|
|
176
|
+
await self._invoke_method(
|
|
193
177
|
method_name="rotate_from",
|
|
194
178
|
arguments={
|
|
195
179
|
"degree": degree,
|
|
@@ -199,29 +183,7 @@ class Map(ft.ConstrainedControl):
|
|
|
199
183
|
},
|
|
200
184
|
)
|
|
201
185
|
|
|
202
|
-
def
|
|
203
|
-
self,
|
|
204
|
-
degree: ft.Number,
|
|
205
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
206
|
-
animation_duration: Optional[ft.DurationValue] = None,
|
|
207
|
-
cancel_ongoing_animations: bool = False,
|
|
208
|
-
) -> None:
|
|
209
|
-
"""
|
|
210
|
-
Applies a rotation of `degree` to the current rotation.
|
|
211
|
-
|
|
212
|
-
Args:
|
|
213
|
-
degree: The number of degrees to increment to the current rotation.
|
|
214
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
215
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
216
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
217
|
-
"""
|
|
218
|
-
asyncio.create_task(
|
|
219
|
-
self.rotate_from_async(
|
|
220
|
-
degree, animation_curve, animation_duration, cancel_ongoing_animations
|
|
221
|
-
)
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
async def reset_rotation_async(
|
|
186
|
+
async def reset_rotation(
|
|
225
187
|
self,
|
|
226
188
|
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
227
189
|
animation_duration: Optional[ft.DurationValue] = None,
|
|
@@ -231,11 +193,14 @@ class Map(ft.ConstrainedControl):
|
|
|
231
193
|
Resets the map's rotation to 0 degrees.
|
|
232
194
|
|
|
233
195
|
Args:
|
|
234
|
-
animation_curve: The curve of the animation. If None (the default),
|
|
235
|
-
|
|
236
|
-
|
|
196
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
197
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
198
|
+
animation_duration: The duration of the animation.
|
|
199
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
200
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
201
|
+
ongoing map-animations before starting this new one.
|
|
237
202
|
"""
|
|
238
|
-
await self.
|
|
203
|
+
await self._invoke_method(
|
|
239
204
|
method_name="reset_rotation",
|
|
240
205
|
arguments={
|
|
241
206
|
"curve": animation_curve or self.animation_curve,
|
|
@@ -244,27 +209,7 @@ class Map(ft.ConstrainedControl):
|
|
|
244
209
|
},
|
|
245
210
|
)
|
|
246
211
|
|
|
247
|
-
def
|
|
248
|
-
self,
|
|
249
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
250
|
-
animation_duration: ft.DurationValue = None,
|
|
251
|
-
cancel_ongoing_animations: bool = False,
|
|
252
|
-
) -> None:
|
|
253
|
-
"""
|
|
254
|
-
Resets the map's rotation to 0 degrees.
|
|
255
|
-
|
|
256
|
-
Args:
|
|
257
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
258
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
259
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
260
|
-
"""
|
|
261
|
-
asyncio.create_task(
|
|
262
|
-
self.reset_rotation_async(
|
|
263
|
-
animation_curve, animation_duration, cancel_ongoing_animations
|
|
264
|
-
)
|
|
265
|
-
)
|
|
266
|
-
|
|
267
|
-
async def zoom_in_async(
|
|
212
|
+
async def zoom_in(
|
|
268
213
|
self,
|
|
269
214
|
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
270
215
|
animation_duration: Optional[ft.DurationValue] = None,
|
|
@@ -274,11 +219,14 @@ class Map(ft.ConstrainedControl):
|
|
|
274
219
|
Zooms in by one zoom-level from the current one.
|
|
275
220
|
|
|
276
221
|
Args:
|
|
277
|
-
animation_curve: The curve of the animation. If None (the default),
|
|
278
|
-
|
|
279
|
-
|
|
222
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
223
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
224
|
+
animation_duration: The duration of the animation.
|
|
225
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
226
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
227
|
+
ongoing map-animations before starting this new one.
|
|
280
228
|
"""
|
|
281
|
-
await self.
|
|
229
|
+
await self._invoke_method(
|
|
282
230
|
method_name="zoom_in",
|
|
283
231
|
arguments={
|
|
284
232
|
"curve": animation_curve or self.animation_curve,
|
|
@@ -287,27 +235,7 @@ class Map(ft.ConstrainedControl):
|
|
|
287
235
|
},
|
|
288
236
|
)
|
|
289
237
|
|
|
290
|
-
def
|
|
291
|
-
self,
|
|
292
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
293
|
-
animation_duration: Optional[ft.DurationValue] = None,
|
|
294
|
-
cancel_ongoing_animations: bool = False,
|
|
295
|
-
) -> None:
|
|
296
|
-
"""
|
|
297
|
-
Zooms in by one zoom-level from the current one.
|
|
298
|
-
|
|
299
|
-
Args:
|
|
300
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
301
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
302
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
303
|
-
"""
|
|
304
|
-
asyncio.create_task(
|
|
305
|
-
self.zoom_in_async(
|
|
306
|
-
animation_curve, animation_duration, cancel_ongoing_animations
|
|
307
|
-
)
|
|
308
|
-
)
|
|
309
|
-
|
|
310
|
-
async def zoom_out_async(
|
|
238
|
+
async def zoom_out(
|
|
311
239
|
self,
|
|
312
240
|
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
313
241
|
animation_duration: Optional[ft.DurationValue] = None,
|
|
@@ -317,11 +245,14 @@ class Map(ft.ConstrainedControl):
|
|
|
317
245
|
Zooms out by one zoom-level from the current one.
|
|
318
246
|
|
|
319
247
|
Args:
|
|
320
|
-
animation_curve: The curve of the animation. If None (the default),
|
|
321
|
-
|
|
322
|
-
|
|
248
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
249
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
250
|
+
animation_duration: The duration of the animation.
|
|
251
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
252
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
253
|
+
ongoing map-animations before starting this new one.
|
|
323
254
|
"""
|
|
324
|
-
await self.
|
|
255
|
+
await self._invoke_method(
|
|
325
256
|
method_name="zoom_out",
|
|
326
257
|
arguments={
|
|
327
258
|
"curve": animation_curve or self.animation_curve,
|
|
@@ -330,27 +261,7 @@ class Map(ft.ConstrainedControl):
|
|
|
330
261
|
},
|
|
331
262
|
)
|
|
332
263
|
|
|
333
|
-
def
|
|
334
|
-
self,
|
|
335
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
336
|
-
animation_duration: Optional[ft.DurationValue] = None,
|
|
337
|
-
cancel_ongoing_animations: bool = False,
|
|
338
|
-
) -> None:
|
|
339
|
-
"""
|
|
340
|
-
Zooms out by one zoom-level from the current one.
|
|
341
|
-
|
|
342
|
-
Args:
|
|
343
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
344
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
345
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
346
|
-
"""
|
|
347
|
-
asyncio.create_task(
|
|
348
|
-
self.zoom_out_async(
|
|
349
|
-
animation_curve, animation_duration, cancel_ongoing_animations
|
|
350
|
-
)
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
async def zoom_to_async(
|
|
264
|
+
async def zoom_to(
|
|
354
265
|
self,
|
|
355
266
|
zoom: ft.Number,
|
|
356
267
|
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
@@ -362,11 +273,14 @@ class Map(ft.ConstrainedControl):
|
|
|
362
273
|
|
|
363
274
|
Args:
|
|
364
275
|
zoom: The zoom level to zoom to.
|
|
365
|
-
animation_curve: The curve of the animation. If None (the default),
|
|
366
|
-
|
|
367
|
-
|
|
276
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
277
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
278
|
+
animation_duration: The duration of the animation.
|
|
279
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
280
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
281
|
+
ongoing map-animations before starting this new one.
|
|
368
282
|
"""
|
|
369
|
-
await self.
|
|
283
|
+
await self._invoke_method(
|
|
370
284
|
method_name="zoom_to",
|
|
371
285
|
arguments={
|
|
372
286
|
"zoom": zoom,
|
|
@@ -376,36 +290,14 @@ class Map(ft.ConstrainedControl):
|
|
|
376
290
|
},
|
|
377
291
|
)
|
|
378
292
|
|
|
379
|
-
def
|
|
380
|
-
self,
|
|
381
|
-
zoom: ft.Number,
|
|
382
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
383
|
-
animation_duration: Optional[ft.DurationValue] = None,
|
|
384
|
-
cancel_ongoing_animations: bool = False,
|
|
385
|
-
) -> None:
|
|
386
|
-
"""
|
|
387
|
-
Zoom the map to a specific zoom level.
|
|
388
|
-
|
|
389
|
-
Args:
|
|
390
|
-
zoom: The zoom level to zoom to.
|
|
391
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
392
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
393
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
394
|
-
"""
|
|
395
|
-
asyncio.create_task(
|
|
396
|
-
self.zoom_to_async(
|
|
397
|
-
zoom, animation_curve, animation_duration, cancel_ongoing_animations
|
|
398
|
-
)
|
|
399
|
-
)
|
|
400
|
-
|
|
401
|
-
async def move_to_async(
|
|
293
|
+
async def move_to(
|
|
402
294
|
self,
|
|
403
295
|
destination: Optional[MapLatitudeLongitude] = None,
|
|
404
296
|
zoom: Optional[ft.Number] = None,
|
|
405
297
|
rotation: Optional[ft.Number] = None,
|
|
406
298
|
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
407
299
|
animation_duration: Optional[ft.DurationValue] = None,
|
|
408
|
-
offset: ft.OffsetValue =
|
|
300
|
+
offset: ft.OffsetValue = (0, 0),
|
|
409
301
|
cancel_ongoing_animations: bool = False,
|
|
410
302
|
) -> None:
|
|
411
303
|
"""
|
|
@@ -413,18 +305,24 @@ class Map(ft.ConstrainedControl):
|
|
|
413
305
|
|
|
414
306
|
Args:
|
|
415
307
|
destination: The destination point to move to.
|
|
416
|
-
zoom: The zoom level to be applied. If provided,
|
|
308
|
+
zoom: The zoom level to be applied. If provided,
|
|
309
|
+
must be greater than or equal to `0.0`.
|
|
417
310
|
rotation: Rotation (in degrees) to be applied.
|
|
418
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
419
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
420
311
|
offset: The offset to be used. Only works when `rotation` is `None`.
|
|
421
|
-
|
|
312
|
+
animation_curve: The curve of the animation. If None (the default),
|
|
313
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
314
|
+
animation_duration: The duration of the animation.
|
|
315
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
316
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
317
|
+
ongoing map-animations before starting this new one.
|
|
422
318
|
|
|
423
319
|
Raises:
|
|
424
320
|
AssertionError: If `zoom` is not `None` and is negative.
|
|
425
321
|
"""
|
|
426
|
-
assert zoom is None or zoom >= 0,
|
|
427
|
-
|
|
322
|
+
assert zoom is None or zoom >= 0, (
|
|
323
|
+
f"zoom must be greater than or equal to zero, got {zoom}"
|
|
324
|
+
)
|
|
325
|
+
await self._invoke_method(
|
|
428
326
|
method_name="move_to",
|
|
429
327
|
arguments={
|
|
430
328
|
"destination": destination,
|
|
@@ -437,44 +335,7 @@ class Map(ft.ConstrainedControl):
|
|
|
437
335
|
},
|
|
438
336
|
)
|
|
439
337
|
|
|
440
|
-
def
|
|
441
|
-
self,
|
|
442
|
-
destination: Optional[MapLatitudeLongitude] = None,
|
|
443
|
-
zoom: Optional[ft.Number] = None,
|
|
444
|
-
rotation: Optional[ft.Number] = None,
|
|
445
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
446
|
-
animation_duration: Optional[ft.DurationValue] = None,
|
|
447
|
-
offset: ft.OffsetValue = ft.Offset(0, 0),
|
|
448
|
-
cancel_ongoing_animations: bool = False,
|
|
449
|
-
) -> None:
|
|
450
|
-
"""
|
|
451
|
-
Moves to a specific location.
|
|
452
|
-
|
|
453
|
-
Args:
|
|
454
|
-
destination: The destination point to move to.
|
|
455
|
-
zoom: The zoom level to be applied. If provided, must be greater than or equal to `0.0`.
|
|
456
|
-
rotation: Rotation (in degrees) to be applied.
|
|
457
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
458
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
459
|
-
offset: The offset to be used. Only works when `rotation` is `None`.
|
|
460
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
461
|
-
|
|
462
|
-
Raises:
|
|
463
|
-
AssertionError: If `zoom` is not `None` and is negative.
|
|
464
|
-
"""
|
|
465
|
-
asyncio.create_task(
|
|
466
|
-
self.move_to_async(
|
|
467
|
-
destination,
|
|
468
|
-
zoom,
|
|
469
|
-
rotation,
|
|
470
|
-
animation_curve,
|
|
471
|
-
animation_duration,
|
|
472
|
-
offset,
|
|
473
|
-
cancel_ongoing_animations,
|
|
474
|
-
)
|
|
475
|
-
)
|
|
476
|
-
|
|
477
|
-
async def center_on_async(
|
|
338
|
+
async def center_on(
|
|
478
339
|
self,
|
|
479
340
|
point: MapLatitudeLongitude,
|
|
480
341
|
zoom: Optional[ft.Number],
|
|
@@ -488,11 +349,14 @@ class Map(ft.ConstrainedControl):
|
|
|
488
349
|
Args:
|
|
489
350
|
point: The point on which to center the map.
|
|
490
351
|
zoom: The zoom level to be applied.
|
|
491
|
-
animation_curve: The curve of the animation. If None (the default),
|
|
492
|
-
|
|
493
|
-
|
|
352
|
+
animation_curve: The curve of the animation. If `None` (the default),
|
|
353
|
+
[`Map.animation_curve`][(p).] will be used.
|
|
354
|
+
animation_duration: The duration of the animation.
|
|
355
|
+
If None (the default), [`Map.animation_duration`][(p).] will be used.
|
|
356
|
+
cancel_ongoing_animations: Whether to cancel/stop all
|
|
357
|
+
ongoing map-animations before starting this new one.
|
|
494
358
|
"""
|
|
495
|
-
await self.
|
|
359
|
+
await self._invoke_method(
|
|
496
360
|
method_name="center_on",
|
|
497
361
|
arguments={
|
|
498
362
|
"point": point,
|
|
@@ -502,31 +366,3 @@ class Map(ft.ConstrainedControl):
|
|
|
502
366
|
"cancel_ongoing_animations": cancel_ongoing_animations,
|
|
503
367
|
},
|
|
504
368
|
)
|
|
505
|
-
|
|
506
|
-
def center_on(
|
|
507
|
-
self,
|
|
508
|
-
point: Optional[MapLatitudeLongitude],
|
|
509
|
-
zoom: Optional[ft.Number],
|
|
510
|
-
animation_curve: Optional[ft.AnimationCurve] = None,
|
|
511
|
-
animation_duration: Optional[ft.DurationValue] = None,
|
|
512
|
-
cancel_ongoing_animations: bool = False,
|
|
513
|
-
) -> None:
|
|
514
|
-
"""
|
|
515
|
-
Centers the map on the given point.
|
|
516
|
-
|
|
517
|
-
Args:
|
|
518
|
-
point: The point on which to center the map.
|
|
519
|
-
zoom: The zoom level to be applied.
|
|
520
|
-
animation_curve: The curve of the animation. If None (the default), `Map.animation_curve` will be used.
|
|
521
|
-
animation_duration: The duration of the animation. If None (the default), `Map.animation_duration` will be used.
|
|
522
|
-
cancel_ongoing_animations: Whether to cancel/stop all ongoing map-animations before starting this new one.
|
|
523
|
-
"""
|
|
524
|
-
asyncio.create_task(
|
|
525
|
-
self.center_on_async(
|
|
526
|
-
point,
|
|
527
|
-
zoom,
|
|
528
|
-
animation_curve,
|
|
529
|
-
animation_duration,
|
|
530
|
-
cancel_ongoing_animations,
|
|
531
|
-
)
|
|
532
|
-
)
|