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/types.py
CHANGED
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
2
|
from enum import Enum, IntFlag
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import TYPE_CHECKING, Optional
|
|
4
4
|
|
|
5
5
|
import flet as ft
|
|
6
6
|
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from flet_map.map import Map # noqa
|
|
9
|
+
|
|
7
10
|
__all__ = [
|
|
8
|
-
"TileLayerEvictErrorTileStrategy",
|
|
9
11
|
"AttributionAlignment",
|
|
10
|
-
"PatternFit",
|
|
11
12
|
"Camera",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"CameraFit",
|
|
14
|
+
"CursorKeyboardRotationConfiguration",
|
|
15
|
+
"CursorRotationBehaviour",
|
|
14
16
|
"DashedStrokePattern",
|
|
15
17
|
"DottedStrokePattern",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"InteractionFlag",
|
|
19
|
-
"MultiFingerGesture",
|
|
18
|
+
"FadeInTileDisplay",
|
|
19
|
+
"InstantaneousTileDisplay",
|
|
20
20
|
"InteractionConfiguration",
|
|
21
|
+
"InteractionFlag",
|
|
22
|
+
"KeyboardConfiguration",
|
|
23
|
+
"MapEvent",
|
|
21
24
|
"MapEventSource",
|
|
22
|
-
"CameraFit",
|
|
23
|
-
"MapTapEvent",
|
|
24
25
|
"MapHoverEvent",
|
|
25
|
-
"
|
|
26
|
+
"MapLatitudeLongitude",
|
|
27
|
+
"MapLatitudeLongitudeBounds",
|
|
26
28
|
"MapPointerEvent",
|
|
27
|
-
"
|
|
29
|
+
"MapPositionChangeEvent",
|
|
30
|
+
"MapTapEvent",
|
|
31
|
+
"MultiFingerGesture",
|
|
32
|
+
"PatternFit",
|
|
33
|
+
"SolidStrokePattern",
|
|
34
|
+
"StrokePattern",
|
|
28
35
|
"TileDisplay",
|
|
29
|
-
"
|
|
30
|
-
"FadeInTileDisplay",
|
|
31
|
-
"KeyboardConfiguration",
|
|
32
|
-
"CursorRotationBehaviour",
|
|
33
|
-
"CursorKeyboardRotationConfiguration",
|
|
36
|
+
"TileLayerEvictErrorTileStrategy",
|
|
34
37
|
]
|
|
35
38
|
|
|
36
39
|
|
|
@@ -54,7 +57,8 @@ class TileLayerEvictErrorTileStrategy(Enum):
|
|
|
54
57
|
"""
|
|
55
58
|
Evict images for tiles which failed to load and:
|
|
56
59
|
- do not belong to the current zoom level AND/OR
|
|
57
|
-
- are not visible, respecting the pruning buffer
|
|
60
|
+
- are not visible, respecting the pruning buffer
|
|
61
|
+
(the maximum of the `keep_buffer` and `pan_buffer`).
|
|
58
62
|
"""
|
|
59
63
|
|
|
60
64
|
|
|
@@ -78,7 +82,7 @@ class PatternFit(Enum):
|
|
|
78
82
|
"""
|
|
79
83
|
Don't apply any specific fit to the pattern - repeat exactly as specified,
|
|
80
84
|
and stop when the last point is reached.
|
|
81
|
-
|
|
85
|
+
|
|
82
86
|
Not recommended, as it may leave a gap between the final segment and the last
|
|
83
87
|
point, making it unclear where the line ends.
|
|
84
88
|
"""
|
|
@@ -107,8 +111,8 @@ class PatternFit(Enum):
|
|
|
107
111
|
Uses the pattern exactly, truncating the final dash if it does not fit, or
|
|
108
112
|
extending the final dash to the last point if it would not normally reach
|
|
109
113
|
that point (there is a gap at that location).
|
|
110
|
-
|
|
111
|
-
Only useful when working with [`DashedStrokePattern`][(p).].
|
|
114
|
+
|
|
115
|
+
Only useful when working with [`DashedStrokePattern`][(p).].
|
|
112
116
|
Similar to `APPEND_DOT` for `DottedStrokePattern`.
|
|
113
117
|
"""
|
|
114
118
|
|
|
@@ -141,7 +145,7 @@ class Camera:
|
|
|
141
145
|
"""
|
|
142
146
|
|
|
143
147
|
|
|
144
|
-
@dataclass
|
|
148
|
+
@dataclass
|
|
145
149
|
class StrokePattern:
|
|
146
150
|
"""
|
|
147
151
|
Determines whether a stroke should be solid, dotted, or dashed,
|
|
@@ -155,7 +159,7 @@ class StrokePattern:
|
|
|
155
159
|
- [`DottedStrokePattern`][(p).]
|
|
156
160
|
"""
|
|
157
161
|
|
|
158
|
-
_type: str =
|
|
162
|
+
_type: Optional[str] = field(init=False, repr=False, compare=False, default=None)
|
|
159
163
|
|
|
160
164
|
|
|
161
165
|
@dataclass
|
|
@@ -172,23 +176,27 @@ class DashedStrokePattern(StrokePattern):
|
|
|
172
176
|
A stroke pattern of alternating dashes and gaps, defined by [`segments`][(c).].
|
|
173
177
|
|
|
174
178
|
Raises:
|
|
175
|
-
AssertionError: If `segments` does not contain at least two items,
|
|
179
|
+
AssertionError: If [`segments`][(c).] does not contain at least two items,
|
|
180
|
+
or has an odd length.
|
|
176
181
|
"""
|
|
177
182
|
|
|
178
|
-
segments:
|
|
183
|
+
segments: list[ft.Number] = field(default_factory=list)
|
|
179
184
|
"""
|
|
180
185
|
A list of alternating dash and gap lengths, in pixels.
|
|
181
|
-
|
|
186
|
+
|
|
182
187
|
Note:
|
|
183
188
|
Must contain at least two items, and have an even length.
|
|
184
189
|
"""
|
|
185
190
|
pattern_fit: PatternFit = PatternFit.SCALE_UP
|
|
186
191
|
"""
|
|
187
|
-
Determines how this stroke pattern should be fit to a line when their lengths
|
|
192
|
+
Determines how this stroke pattern should be fit to a line when their lengths
|
|
193
|
+
are not equal or multiples.
|
|
188
194
|
"""
|
|
189
195
|
|
|
190
196
|
def __post_init__(self):
|
|
191
|
-
assert len(self.segments) >= 2,
|
|
197
|
+
assert len(self.segments) >= 2, (
|
|
198
|
+
f"segments must contain at least two items, got {len(self.segments)}"
|
|
199
|
+
)
|
|
192
200
|
assert len(self.segments) % 2 == 0, "segments must have an even length"
|
|
193
201
|
self._type = "dashed"
|
|
194
202
|
|
|
@@ -204,25 +212,27 @@ class DottedStrokePattern(StrokePattern):
|
|
|
204
212
|
|
|
205
213
|
spacing_factor: ft.Number = 1.5
|
|
206
214
|
"""
|
|
207
|
-
The multiplier used to calculate the spacing between dots in a dotted polyline,
|
|
215
|
+
The multiplier used to calculate the spacing between dots in a dotted polyline,
|
|
208
216
|
with respect to `Polyline.stroke_width` / `Polygon.border_stroke_width`.
|
|
209
|
-
A value of `1.0` will result in spacing equal to the `stroke_width`.
|
|
217
|
+
A value of `1.0` will result in spacing equal to the `stroke_width`.
|
|
210
218
|
Increasing the value increases the spacing with the same scaling.
|
|
211
|
-
|
|
219
|
+
|
|
212
220
|
May also be scaled by the use of [`PatternFit.SCALE_UP`][(p).].
|
|
213
|
-
|
|
221
|
+
|
|
214
222
|
Note:
|
|
215
223
|
Must be non-negative.
|
|
216
224
|
"""
|
|
217
225
|
pattern_fit: PatternFit = PatternFit.SCALE_UP
|
|
218
226
|
"""
|
|
219
|
-
Determines how this stroke pattern should be fit to a line when their
|
|
227
|
+
Determines how this stroke pattern should be fit to a line when their
|
|
228
|
+
lengths are not equal or multiples.
|
|
220
229
|
"""
|
|
221
230
|
|
|
222
231
|
def __post_init__(self):
|
|
223
|
-
assert (
|
|
224
|
-
|
|
225
|
-
|
|
232
|
+
assert self.spacing_factor > 0, (
|
|
233
|
+
f"spacing_factor must be greater than or equal to 0.0, "
|
|
234
|
+
f"got {self.spacing_factor}"
|
|
235
|
+
)
|
|
226
236
|
self._type = "dotted"
|
|
227
237
|
|
|
228
238
|
|
|
@@ -256,8 +266,8 @@ class InteractionFlag(IntFlag):
|
|
|
256
266
|
Flags to enable/disable certain interaction events on the map.
|
|
257
267
|
|
|
258
268
|
Example:
|
|
259
|
-
- `InteractionFlag.ALL` to enable all events
|
|
260
|
-
- `InteractionFlag.NONE` to disable all events
|
|
269
|
+
- [`InteractionFlag.ALL`][(p).] to enable all events
|
|
270
|
+
- [`InteractionFlag.NONE`][(p).] to disable all events
|
|
261
271
|
"""
|
|
262
272
|
|
|
263
273
|
NONE = 0
|
|
@@ -303,7 +313,8 @@ class InteractionFlag(IntFlag):
|
|
|
303
313
|
def has_flag(left_flags: int, right_flags: int) -> bool:
|
|
304
314
|
"""
|
|
305
315
|
Returns:
|
|
306
|
-
`True` if `left_flags` has at least one member
|
|
316
|
+
`True` if `left_flags` has at least one member
|
|
317
|
+
in `right_flags` (intersection).
|
|
307
318
|
"""
|
|
308
319
|
return left_flags & right_flags != 0
|
|
309
320
|
|
|
@@ -312,7 +323,9 @@ class InteractionFlag(IntFlag):
|
|
|
312
323
|
"""
|
|
313
324
|
Returns:
|
|
314
325
|
`True` if any multi-finger gesture flags
|
|
315
|
-
|
|
326
|
+
([`MultiFingerGesture.PINCH_MOVE`][(p).],
|
|
327
|
+
[`MultiFingerGesture.PINCH_ZOOM`][(p).],
|
|
328
|
+
[`MultiFingerGesture.ROTATE`][(p).]) are enabled.
|
|
316
329
|
"""
|
|
317
330
|
return InteractionFlag.has_flag(
|
|
318
331
|
flags,
|
|
@@ -327,7 +340,8 @@ class InteractionFlag(IntFlag):
|
|
|
327
340
|
def has_drag(flags: int) -> bool:
|
|
328
341
|
"""
|
|
329
342
|
Returns:
|
|
330
|
-
`True` if the [`DRAG`][
|
|
343
|
+
`True` if the [`DRAG`][flet_map.InteractionFlag.DRAG] interaction
|
|
344
|
+
flag is enabled.
|
|
331
345
|
"""
|
|
332
346
|
return InteractionFlag.has_flag(flags, InteractionFlag.DRAG)
|
|
333
347
|
|
|
@@ -335,7 +349,8 @@ class InteractionFlag(IntFlag):
|
|
|
335
349
|
def has_fling_animation(flags: int) -> bool:
|
|
336
350
|
"""
|
|
337
351
|
Returns:
|
|
338
|
-
`True` if the [`FLING_ANIMATION`][
|
|
352
|
+
`True` if the [`FLING_ANIMATION`][flet_map.InteractionFlag.FLING_ANIMATION]
|
|
353
|
+
interaction flag is enabled.
|
|
339
354
|
"""
|
|
340
355
|
return InteractionFlag.has_flag(flags, InteractionFlag.FLING_ANIMATION)
|
|
341
356
|
|
|
@@ -343,7 +358,8 @@ class InteractionFlag(IntFlag):
|
|
|
343
358
|
def has_pinch_move(flags: int) -> bool:
|
|
344
359
|
"""
|
|
345
360
|
Returns:
|
|
346
|
-
`True` if the [`PINCH_MOVE`][
|
|
361
|
+
`True` if the [`PINCH_MOVE`][flet_map.InteractionFlag.PINCH_MOVE]
|
|
362
|
+
interaction flag is enabled.
|
|
347
363
|
"""
|
|
348
364
|
return InteractionFlag.has_flag(flags, InteractionFlag.PINCH_MOVE)
|
|
349
365
|
|
|
@@ -351,7 +367,8 @@ class InteractionFlag(IntFlag):
|
|
|
351
367
|
def has_fling_pinch_zoom(flags: int) -> bool:
|
|
352
368
|
"""
|
|
353
369
|
Returns:
|
|
354
|
-
`True` if the [`PINCH_ZOOM`][
|
|
370
|
+
`True` if the [`PINCH_ZOOM`][flet_map.InteractionFlag.PINCH_ZOOM]
|
|
371
|
+
interaction flag is enabled.
|
|
355
372
|
"""
|
|
356
373
|
return InteractionFlag.has_flag(flags, InteractionFlag.PINCH_ZOOM)
|
|
357
374
|
|
|
@@ -359,7 +376,9 @@ class InteractionFlag(IntFlag):
|
|
|
359
376
|
def has_double_tap_drag_zoom(flags: int) -> bool:
|
|
360
377
|
"""
|
|
361
378
|
Returns:
|
|
362
|
-
`True` if the
|
|
379
|
+
`True` if the
|
|
380
|
+
[`DOUBLE_TAP_DRAG_ZOOM`][flet_map.InteractionFlag.DOUBLE_TAP_DRAG_ZOOM]
|
|
381
|
+
interaction flag is enabled.
|
|
363
382
|
"""
|
|
364
383
|
return InteractionFlag.has_flag(flags, InteractionFlag.DOUBLE_TAP_DRAG_ZOOM)
|
|
365
384
|
|
|
@@ -367,7 +386,8 @@ class InteractionFlag(IntFlag):
|
|
|
367
386
|
def has_double_tap_zoom(flags: int) -> bool:
|
|
368
387
|
"""
|
|
369
388
|
Returns:
|
|
370
|
-
`True` if the [`DOUBLE_TAP_ZOOM`][
|
|
389
|
+
`True` if the [`DOUBLE_TAP_ZOOM`][flet_map.InteractionFlag.DOUBLE_TAP_ZOOM]
|
|
390
|
+
interaction flag is enabled.
|
|
371
391
|
"""
|
|
372
392
|
return InteractionFlag.has_flag(flags, InteractionFlag.DOUBLE_TAP_ZOOM)
|
|
373
393
|
|
|
@@ -383,7 +403,7 @@ class InteractionFlag(IntFlag):
|
|
|
383
403
|
def has_scroll_wheel_zoom(flags: int) -> bool:
|
|
384
404
|
"""
|
|
385
405
|
Returns:
|
|
386
|
-
`True` if the [`SCROLL_WHEEL_ZOOM`][..]
|
|
406
|
+
`True` if the [`SCROLL_WHEEL_ZOOM`][..] interaction flag is enabled.
|
|
387
407
|
"""
|
|
388
408
|
return InteractionFlag.has_flag(flags, InteractionFlag.SCROLL_WHEEL_ZOOM)
|
|
389
409
|
|
|
@@ -398,7 +418,9 @@ class MultiFingerGesture(IntFlag):
|
|
|
398
418
|
"""Pinch move gesture, which allows moving the map by dragging with two fingers."""
|
|
399
419
|
|
|
400
420
|
PINCH_ZOOM = 1 << 1
|
|
401
|
-
"""
|
|
421
|
+
"""
|
|
422
|
+
Pinch zoom gesture, which allows zooming in and out by pinching with two fingers.
|
|
423
|
+
"""
|
|
402
424
|
|
|
403
425
|
ROTATE = 1 << 2
|
|
404
426
|
"""Rotate gesture, which allows rotating the map by twisting two fingers."""
|
|
@@ -411,43 +433,51 @@ class MultiFingerGesture(IntFlag):
|
|
|
411
433
|
class InteractionConfiguration:
|
|
412
434
|
enable_multi_finger_gesture_race: bool = False
|
|
413
435
|
"""
|
|
414
|
-
If `True`, then [`rotation_threshold`][..] and [`pinch_zoom_threshold`][..]
|
|
415
|
-
|
|
416
|
-
|
|
436
|
+
If `True`, then [`rotation_threshold`][..] and [`pinch_zoom_threshold`][..]
|
|
437
|
+
and [`pinch_move_threshold`][..] will race.
|
|
438
|
+
If multiple gestures win at the same time, then precedence:
|
|
439
|
+
[`pinch_zoom_win_gestures`][..] > [`rotation_win_gestures`][..] >
|
|
440
|
+
[`pinch_move_win_gestures`][..]
|
|
417
441
|
"""
|
|
418
442
|
|
|
419
443
|
pinch_move_threshold: ft.Number = 40.0
|
|
420
444
|
"""
|
|
421
|
-
Map starts to move when `pinch_move_threshold` has been achieved
|
|
422
|
-
or another multi finger gesture wins which allows
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
445
|
+
Map starts to move when `pinch_move_threshold` has been achieved
|
|
446
|
+
or another multi finger gesture wins which allows
|
|
447
|
+
[`MultiFingerGesture.PINCH_MOVE`][(p).].
|
|
448
|
+
|
|
449
|
+
Note:
|
|
450
|
+
If [`InteractionConfiguration.flags`][(p).] doesn't contain
|
|
451
|
+
[`InteractionFlag.PINCH_MOVE`][(p).]
|
|
426
452
|
or [`enable_multi_finger_gesture_race`][..] is false then pinch move cannot win.
|
|
427
453
|
"""
|
|
428
454
|
|
|
429
455
|
scroll_wheel_velocity: ft.Number = 0.005
|
|
430
456
|
"""
|
|
431
|
-
The used velocity how fast the map should zoom in or out by scrolling
|
|
457
|
+
The used velocity how fast the map should zoom in or out by scrolling
|
|
458
|
+
with the scroll wheel of a mouse.
|
|
432
459
|
"""
|
|
433
460
|
|
|
434
461
|
pinch_zoom_threshold: ft.Number = 0.5
|
|
435
462
|
"""
|
|
436
|
-
Map starts to zoom when `pinch_zoom_threshold` has been achieved or
|
|
437
|
-
another multi finger gesture wins which allows
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
463
|
+
Map starts to zoom when `pinch_zoom_threshold` has been achieved or
|
|
464
|
+
another multi finger gesture wins which allows
|
|
465
|
+
[`MultiFingerGesture.PINCH_ZOOM`][(p).].
|
|
466
|
+
|
|
467
|
+
Note:
|
|
468
|
+
If [`InteractionConfiguration.flags`][(p).]
|
|
469
|
+
doesn't contain [`InteractionFlag.PINCH_ZOOM`][(p).]
|
|
441
470
|
or [`enable_multi_finger_gesture_race`][..] is false then zoom cannot win.
|
|
442
471
|
"""
|
|
443
472
|
|
|
444
473
|
rotation_threshold: ft.Number = 20.0
|
|
445
474
|
"""
|
|
446
|
-
Map starts to rotate when `rotation_threshold` has been achieved or
|
|
475
|
+
Map starts to rotate when `rotation_threshold` has been achieved or
|
|
447
476
|
another multi finger gesture wins which allows [`MultiFingerGesture.ROTATE`][(p).].
|
|
448
|
-
|
|
449
|
-
Note:
|
|
450
|
-
If [`InteractionConfiguration.flags`][(p).]
|
|
477
|
+
|
|
478
|
+
Note:
|
|
479
|
+
If [`InteractionConfiguration.flags`][(p).]
|
|
480
|
+
doesn't contain [`InteractionFlag.ROTATE`][(p).]
|
|
451
481
|
or [`enable_multi_finger_gesture_race`][..] is false then rotate cannot win.
|
|
452
482
|
"""
|
|
453
483
|
|
|
@@ -458,8 +488,8 @@ class InteractionConfiguration:
|
|
|
458
488
|
|
|
459
489
|
rotation_win_gestures: MultiFingerGesture = MultiFingerGesture.ROTATE
|
|
460
490
|
"""
|
|
461
|
-
When [`rotation_threshold`[..] wins over [`pinch_zoom_threshold`[..] and
|
|
462
|
-
[`pinch_move_threshold`[..] then `rotation_win_gestures` gestures will be used.
|
|
491
|
+
When [`rotation_threshold`][..] wins over [`pinch_zoom_threshold`][..] and
|
|
492
|
+
[`pinch_move_threshold`][..] then `rotation_win_gestures` gestures will be used.
|
|
463
493
|
"""
|
|
464
494
|
|
|
465
495
|
pinch_move_win_gestures: MultiFingerGesture = (
|
|
@@ -467,9 +497,11 @@ class InteractionConfiguration:
|
|
|
467
497
|
)
|
|
468
498
|
"""
|
|
469
499
|
When [`pinch_move_threshold`][..] wins over [`rotation_threshold`][..]
|
|
470
|
-
and [`pinch_zoom_threshold`][..] then `pinch_move_win_gestures` gestures
|
|
471
|
-
|
|
472
|
-
|
|
500
|
+
and [`pinch_zoom_threshold`][..] then `pinch_move_win_gestures` gestures
|
|
501
|
+
will be used.
|
|
502
|
+
|
|
503
|
+
By default [`MultiFingerGesture.PINCH_MOVE`][(p).]
|
|
504
|
+
and [`MultiFingerGesture.PINCH_ZOOM`][(p).]
|
|
473
505
|
gestures will take effect see [`MultiFingerGesture`][(p).] for custom settings.
|
|
474
506
|
"""
|
|
475
507
|
|
|
@@ -477,10 +509,12 @@ class InteractionConfiguration:
|
|
|
477
509
|
MultiFingerGesture.PINCH_ZOOM | MultiFingerGesture.PINCH_MOVE
|
|
478
510
|
)
|
|
479
511
|
"""
|
|
480
|
-
When [`pinch_zoom_threshold`][..] wins over [`rotation_threshold`][..]
|
|
512
|
+
When [`pinch_zoom_threshold`][..] wins over [`rotation_threshold`][..]
|
|
513
|
+
and [`pinch_move_threshold`][..]
|
|
481
514
|
then `pinch_zoom_win_gestures` gestures will be used.
|
|
482
|
-
|
|
483
|
-
By default [`MultiFingerGesture.PINCH_ZOOM`][(p).]
|
|
515
|
+
|
|
516
|
+
By default [`MultiFingerGesture.PINCH_ZOOM`][(p).]
|
|
517
|
+
and [`MultiFingerGesture.PINCH_MOVE`][(p).]
|
|
484
518
|
gestures will take effect see `MultiFingerGesture` for custom settings.
|
|
485
519
|
"""
|
|
486
520
|
|
|
@@ -489,7 +523,7 @@ class InteractionConfiguration:
|
|
|
489
523
|
)
|
|
490
524
|
"""
|
|
491
525
|
Options to configure how keyboard keys may be used to control the map.
|
|
492
|
-
|
|
526
|
+
|
|
493
527
|
Keyboard movements using the arrow keys are enabled by default.
|
|
494
528
|
"""
|
|
495
529
|
|
|
@@ -497,7 +531,8 @@ class InteractionConfiguration:
|
|
|
497
531
|
field(default_factory=lambda: CursorKeyboardRotationConfiguration())
|
|
498
532
|
)
|
|
499
533
|
"""
|
|
500
|
-
Options to control the keyboard and mouse cursor being used together
|
|
534
|
+
Options to control the keyboard and mouse cursor being used together
|
|
535
|
+
to rotate the map.
|
|
501
536
|
"""
|
|
502
537
|
|
|
503
538
|
|
|
@@ -542,12 +577,13 @@ class MapEventSource(Enum):
|
|
|
542
577
|
|
|
543
578
|
FLING_ANIMATION_CONTROLLER = "flingAnimationController"
|
|
544
579
|
"""
|
|
545
|
-
The `MapEvent` is caused by the `AnimationController` while
|
|
580
|
+
The `MapEvent` is caused by the `AnimationController` while
|
|
581
|
+
performing the fling gesture.
|
|
546
582
|
"""
|
|
547
583
|
|
|
548
584
|
DOUBLE_TAP_ZOOM_ANIMATION_CONTROLLER = "doubleTapZoomAnimationController"
|
|
549
585
|
"""
|
|
550
|
-
The `MapEvent` is caused by the `AnimationController`
|
|
586
|
+
The `MapEvent` is caused by the `AnimationController`
|
|
551
587
|
while performing the double tap zoom in animation.
|
|
552
588
|
"""
|
|
553
589
|
|
|
@@ -570,30 +606,35 @@ class MapEventSource(Enum):
|
|
|
570
606
|
"""The `MapEvent` is caused by a 'CTRL + drag' rotation gesture."""
|
|
571
607
|
|
|
572
608
|
KEYBOARD = "keyboard"
|
|
573
|
-
"""
|
|
609
|
+
"""
|
|
610
|
+
The `MapEvent` is caused by a keyboard key.
|
|
611
|
+
See [`KeyboardConfiguration`][(p).] for details.
|
|
612
|
+
"""
|
|
574
613
|
|
|
575
614
|
|
|
576
615
|
@dataclass
|
|
577
616
|
class CameraFit:
|
|
578
617
|
"""
|
|
579
|
-
Defines how the camera should fit the bounds or coordinates,
|
|
618
|
+
Defines how the camera should fit the bounds or coordinates,
|
|
619
|
+
depending on which one was provided.
|
|
580
620
|
|
|
581
621
|
Raises:
|
|
582
|
-
AssertionError: If both [`bounds`][(c).] and [`coordinates`][(c).]
|
|
622
|
+
AssertionError: If both [`bounds`][(c).] and [`coordinates`][(c).]
|
|
623
|
+
are `None` or not `None`.
|
|
583
624
|
"""
|
|
584
625
|
|
|
585
626
|
bounds: Optional[MapLatitudeLongitudeBounds] = None
|
|
586
627
|
"""
|
|
587
628
|
The bounds which the camera should contain once it is fitted.
|
|
588
|
-
|
|
629
|
+
|
|
589
630
|
Note:
|
|
590
631
|
If this is not `None`, [`coordinates`][..] should be `None`, and vice versa.
|
|
591
632
|
"""
|
|
592
633
|
|
|
593
|
-
coordinates: Optional[
|
|
634
|
+
coordinates: Optional[list[MapLatitudeLongitude]] = None
|
|
594
635
|
"""
|
|
595
636
|
The coordinates which the camera should contain once it is fitted.
|
|
596
|
-
|
|
637
|
+
|
|
597
638
|
Note:
|
|
598
639
|
If this is not `None`, [`bounds`][..] should be `None`, and vice versa.
|
|
599
640
|
"""
|
|
@@ -601,7 +642,9 @@ class CameraFit:
|
|
|
601
642
|
max_zoom: Optional[ft.Number] = None
|
|
602
643
|
"""
|
|
603
644
|
The inclusive upper zoom limit used for the resulting fit.
|
|
604
|
-
|
|
645
|
+
|
|
646
|
+
If the zoom level calculated for the fit exceeds the `max_zoom` value,
|
|
647
|
+
`max_zoom` will be used instead.
|
|
605
648
|
"""
|
|
606
649
|
|
|
607
650
|
min_zoom: ft.Number = 0.0
|
|
@@ -615,7 +658,8 @@ class CameraFit:
|
|
|
615
658
|
|
|
616
659
|
force_integer_zoom_level: bool = False
|
|
617
660
|
"""
|
|
618
|
-
Whether the zoom level of the resulting fit should be rounded to the
|
|
661
|
+
Whether the zoom level of the resulting fit should be rounded to the
|
|
662
|
+
nearest integer level.
|
|
619
663
|
"""
|
|
620
664
|
|
|
621
665
|
def __post_init__(self):
|
|
@@ -625,31 +669,31 @@ class CameraFit:
|
|
|
625
669
|
|
|
626
670
|
|
|
627
671
|
@dataclass
|
|
628
|
-
class MapTapEvent(ft.TapEvent):
|
|
672
|
+
class MapTapEvent(ft.TapEvent["Map"]):
|
|
629
673
|
coordinates: MapLatitudeLongitude
|
|
630
674
|
"""Coordinates of the point at which the tap occured."""
|
|
631
675
|
|
|
632
676
|
|
|
633
677
|
@dataclass
|
|
634
|
-
class MapHoverEvent(ft.HoverEvent):
|
|
678
|
+
class MapHoverEvent(ft.HoverEvent["Map"]):
|
|
635
679
|
coordinates: MapLatitudeLongitude
|
|
636
680
|
|
|
637
681
|
|
|
638
682
|
@dataclass
|
|
639
|
-
class MapPositionChangeEvent(ft.Event[
|
|
683
|
+
class MapPositionChangeEvent(ft.Event["Map"]):
|
|
640
684
|
coordinates: MapLatitudeLongitude
|
|
641
685
|
camera: Camera
|
|
642
686
|
has_gesture: bool
|
|
643
687
|
|
|
644
688
|
|
|
645
689
|
@dataclass
|
|
646
|
-
class MapPointerEvent(ft.PointerEvent):
|
|
690
|
+
class MapPointerEvent(ft.PointerEvent["Map"]):
|
|
647
691
|
coordinates: MapLatitudeLongitude
|
|
648
692
|
"""Coordinates of the point at which the tap occured."""
|
|
649
693
|
|
|
650
694
|
|
|
651
695
|
@dataclass
|
|
652
|
-
class MapEvent(ft.Event[
|
|
696
|
+
class MapEvent(ft.Event["Map"]):
|
|
653
697
|
source: MapEventSource
|
|
654
698
|
"""Who/what issued the event."""
|
|
655
699
|
|
|
@@ -657,7 +701,7 @@ class MapEvent(ft.Event[ft.EventControlType]):
|
|
|
657
701
|
"""The map camera after the event."""
|
|
658
702
|
|
|
659
703
|
|
|
660
|
-
@dataclass
|
|
704
|
+
@dataclass
|
|
661
705
|
class TileDisplay:
|
|
662
706
|
"""
|
|
663
707
|
Defines how the tile should get displayed on the map.
|
|
@@ -669,7 +713,7 @@ class TileDisplay:
|
|
|
669
713
|
- `FadeInTileDisplay`
|
|
670
714
|
"""
|
|
671
715
|
|
|
672
|
-
_type: str =
|
|
716
|
+
_type: Optional[str] = field(init=False, repr=False, compare=False, default=None)
|
|
673
717
|
|
|
674
718
|
|
|
675
719
|
@dataclass
|
|
@@ -682,9 +726,9 @@ class InstantaneousTileDisplay(TileDisplay):
|
|
|
682
726
|
"""
|
|
683
727
|
|
|
684
728
|
def __post_init__(self):
|
|
685
|
-
assert (
|
|
686
|
-
0.0
|
|
687
|
-
)
|
|
729
|
+
assert 0.0 <= self.opacity <= 1.0, (
|
|
730
|
+
f"opacity must be between 0.0 and 1.0 inclusive, got {self.opacity}"
|
|
731
|
+
)
|
|
688
732
|
self._type = "instantaneous"
|
|
689
733
|
|
|
690
734
|
|
|
@@ -710,12 +754,14 @@ class FadeInTileDisplay(TileDisplay):
|
|
|
710
754
|
"""
|
|
711
755
|
|
|
712
756
|
def __post_init__(self):
|
|
713
|
-
assert (
|
|
714
|
-
0.0
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
757
|
+
assert 0.0 <= self.start_opacity <= 1.0, (
|
|
758
|
+
f"start_opacity must be between 0.0 and 1.0 inclusive, "
|
|
759
|
+
f"got {self.start_opacity}"
|
|
760
|
+
)
|
|
761
|
+
assert 0.0 <= self.reload_start_opacity <= 1.0, (
|
|
762
|
+
f"reload_start_opacity must be between 0.0 and 1.0 inclusive, "
|
|
763
|
+
f"got {self.reload_start_opacity}"
|
|
764
|
+
)
|
|
719
765
|
self._type = "fadein"
|
|
720
766
|
|
|
721
767
|
|
|
@@ -733,36 +779,41 @@ class KeyboardConfiguration:
|
|
|
733
779
|
scales the velocity of the concerned gesture.
|
|
734
780
|
|
|
735
781
|
Info:
|
|
736
|
-
See [`CursorKeyboardRotationConfiguration`][(p).] for options
|
|
782
|
+
See [`CursorKeyboardRotationConfiguration`][(p).] for options
|
|
783
|
+
to control the keyboard and
|
|
737
784
|
mouse cursor being used together to rotate the map.
|
|
738
785
|
"""
|
|
739
786
|
|
|
740
787
|
autofocus: bool = True
|
|
741
788
|
"""
|
|
742
|
-
Whether to request focus as soon as the map control appears
|
|
789
|
+
Whether to request focus as soon as the map control appears
|
|
790
|
+
(and to enable keyboard controls).
|
|
743
791
|
"""
|
|
744
792
|
|
|
745
793
|
animation_curve_duration: ft.DurationValue = field(
|
|
746
794
|
default_factory=lambda: ft.Duration(milliseconds=450)
|
|
747
795
|
)
|
|
748
796
|
"""
|
|
749
|
-
Duration of the curved (`
|
|
750
|
-
|
|
797
|
+
Duration of the curved ([`Curve.EASE_IN`][flet.Curve.EASE_IN])
|
|
798
|
+
portion of the animation occuring
|
|
799
|
+
after a key down event (and after a key up event if
|
|
800
|
+
[`animation_curve_reverse_duration`][..] is `None`)
|
|
751
801
|
"""
|
|
752
802
|
|
|
753
803
|
animation_curve_reverse_duration: Optional[ft.DurationValue] = field(
|
|
754
804
|
default_factory=lambda: ft.Duration(milliseconds=600)
|
|
755
805
|
)
|
|
756
806
|
"""
|
|
757
|
-
Duration of the curved (reverse `
|
|
758
|
-
occuring after a key up event.
|
|
807
|
+
Duration of the curved (reverse [`Curve.EASE_IN`][flet.Curve.EASE_IN])
|
|
808
|
+
portion of the animation occuring after a key up event.
|
|
759
809
|
|
|
760
810
|
Set to `None` to use [`animation_curve_duration`][..].
|
|
761
811
|
"""
|
|
762
812
|
|
|
763
813
|
animation_curve_curve: bool = True
|
|
764
814
|
"""
|
|
765
|
-
Curve of the curved portion of the animation occuring after
|
|
815
|
+
Curve of the curved portion of the animation occuring after
|
|
816
|
+
key down and key up events.
|
|
766
817
|
"""
|
|
767
818
|
|
|
768
819
|
enable_arrow_keys_panning: bool = True
|
|
@@ -772,55 +823,61 @@ class KeyboardConfiguration:
|
|
|
772
823
|
|
|
773
824
|
enable_qe_rotating: bool = True
|
|
774
825
|
"""
|
|
775
|
-
Whether to allow the Q & E keys (*) to rotate the map (Q rotates
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
826
|
+
Whether to allow the `Q` & `E` keys (*) to rotate the map (`Q` rotates
|
|
827
|
+
anticlockwise, `E` rotates clockwise).
|
|
828
|
+
|
|
829
|
+
QE are only the physical and logical keys on QWERTY keyboards.
|
|
830
|
+
On non- QWERTY keyboards, such as AZERTY,
|
|
779
831
|
the keys in the same position as on the QWERTY keyboard is used (ie. AE on AZERTY).
|
|
780
832
|
"""
|
|
781
833
|
|
|
782
834
|
enable_rf_zooming: bool = True
|
|
783
835
|
"""
|
|
784
|
-
Whether to allow the R & F keys to zoom the map (R zooms IN
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
836
|
+
Whether to allow the `R` & `F` keys to zoom the map (`R` zooms IN
|
|
837
|
+
(increases zoom level), `F` zooms OUT (decreases zoom level)).
|
|
838
|
+
|
|
839
|
+
RF are only the physical and logical keys on QWERTY keyboards.
|
|
840
|
+
On non- QWERTY keyboards, such as AZERTY,
|
|
788
841
|
the keys in the same position as on the QWERTY keyboard is used (ie. RF on AZERTY).
|
|
789
842
|
"""
|
|
790
843
|
|
|
791
844
|
enable_wasd_panning: bool = True
|
|
792
845
|
"""
|
|
793
|
-
Whether to allow the W
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
846
|
+
Whether to allow the `W`, `A`, `S`, `D` keys (*) to pan the map
|
|
847
|
+
(in the directions UP, LEFT, DOWN, RIGHT respectively).
|
|
848
|
+
|
|
849
|
+
WASD are only the physical and logical keys on QWERTY keyboards.
|
|
850
|
+
On non- QWERTY keyboards, such as AZERTY,
|
|
851
|
+
the keys in the same position as on the QWERTY keyboard is
|
|
852
|
+
used (ie. ZQSD on AZERTY).
|
|
853
|
+
|
|
854
|
+
If enabled, it is recommended to enable `enable_arrow_keys_panning`
|
|
855
|
+
to provide panning functionality easily for left handed users.
|
|
800
856
|
"""
|
|
801
857
|
|
|
802
858
|
leap_max_of_curve_component: ft.Number = 0.6
|
|
803
859
|
"""
|
|
804
860
|
The percentage (0.0 - 1.0) of the curve animation component that is driven
|
|
805
861
|
to (from 0), then in reverse from (to 0).
|
|
806
|
-
|
|
862
|
+
|
|
807
863
|
Reducing means the leap occurs quicker (assuming a consistent curve
|
|
808
864
|
animation duration). Also see `*_leap_velocity_multiplier` properties to
|
|
809
865
|
change the distance of the leap assuming a consistent leap duration.
|
|
810
|
-
|
|
811
|
-
For example, if set to 1, then the leap will take
|
|
866
|
+
|
|
867
|
+
For example, if set to 1, then the leap will take
|
|
868
|
+
`animation_curve_duration + animation_curve_reverse_duration`
|
|
812
869
|
to complete.
|
|
813
870
|
|
|
814
|
-
Must be greater than 0 and less than or equal to 1.
|
|
815
|
-
To disable leaping, or change the maximum length of the key press
|
|
816
|
-
that will trigger a leap, see [`perform_leap_trigger_duration`[..].
|
|
871
|
+
Must be greater than 0 and less than or equal to 1.
|
|
872
|
+
To disable leaping, or change the maximum length of the key press
|
|
873
|
+
that will trigger a leap, see [`perform_leap_trigger_duration`][..].
|
|
817
874
|
"""
|
|
818
875
|
|
|
819
876
|
max_rotate_velocity: ft.Number = 3
|
|
820
877
|
"""
|
|
821
878
|
The maximum angular difference to apply per frame to the camera's rotation
|
|
822
879
|
during a rotation animation.
|
|
823
|
-
|
|
880
|
+
|
|
824
881
|
Measured in degrees. Negative numbers will flip the standard rotation keys.
|
|
825
882
|
"""
|
|
826
883
|
|
|
@@ -828,7 +885,7 @@ class KeyboardConfiguration:
|
|
|
828
885
|
"""
|
|
829
886
|
The maximum zoom level difference to apply per frame to the camera's zoom
|
|
830
887
|
level during a zoom animation.
|
|
831
|
-
|
|
888
|
+
|
|
832
889
|
Measured in zoom levels. Negative numbers will flip the standard zoom keys.
|
|
833
890
|
"""
|
|
834
891
|
|
|
@@ -836,10 +893,10 @@ class KeyboardConfiguration:
|
|
|
836
893
|
"""
|
|
837
894
|
The amount to scale the panning offset velocity by during a leap animation.
|
|
838
895
|
|
|
839
|
-
The larger the number, the larger the movement during a leap.
|
|
840
|
-
To change the duration of a leap, see [`leap_max_of_curve_component`[..].
|
|
841
|
-
|
|
842
|
-
This may cause the pan velocity to exceed [`max_pan_velocity`[..].
|
|
896
|
+
The larger the number, the larger the movement during a leap.
|
|
897
|
+
To change the duration of a leap, see [`leap_max_of_curve_component`][..].
|
|
898
|
+
|
|
899
|
+
This may cause the pan velocity to exceed [`max_pan_velocity`][..].
|
|
843
900
|
"""
|
|
844
901
|
|
|
845
902
|
rotate_leap_velocity_multiplier: ft.Number = 3
|
|
@@ -847,19 +904,19 @@ class KeyboardConfiguration:
|
|
|
847
904
|
The amount to scale the rotation velocity by during a leap animation
|
|
848
905
|
|
|
849
906
|
The larger the number, the larger the rotation difference during a leap.
|
|
850
|
-
To change the duration of a leap, see [`leap_max_of_curve_component`[..].
|
|
851
|
-
|
|
852
|
-
This may cause the pan velocity to exceed [`max_rotate_velocity`[..].
|
|
907
|
+
To change the duration of a leap, see [`leap_max_of_curve_component`][..].
|
|
908
|
+
|
|
909
|
+
This may cause the pan velocity to exceed [`max_rotate_velocity`][..].
|
|
853
910
|
"""
|
|
854
911
|
|
|
855
912
|
zoom_leap_velocity_multiplier: ft.Number = 3
|
|
856
913
|
"""
|
|
857
914
|
The amount to scale the zooming velocity by during a leap animation.
|
|
858
|
-
|
|
915
|
+
|
|
859
916
|
The larger the number, the larger the zoom difference during a leap. To
|
|
860
|
-
change the duration of a leap, see [`leap_max_of_curve_component`[..].
|
|
861
|
-
|
|
862
|
-
This may cause the pan velocity to exceed [`max_zoom_velocity`[..].
|
|
917
|
+
change the duration of a leap, see [`leap_max_of_curve_component`][..].
|
|
918
|
+
|
|
919
|
+
This may cause the pan velocity to exceed [`max_zoom_velocity`][..].
|
|
863
920
|
"""
|
|
864
921
|
|
|
865
922
|
perform_leap_trigger_duration: Optional[ft.DurationValue] = field(
|
|
@@ -868,10 +925,12 @@ class KeyboardConfiguration:
|
|
|
868
925
|
"""
|
|
869
926
|
Maximum duration between the key down and key up events of an animation
|
|
870
927
|
which will trigger a 'leap'.
|
|
871
|
-
|
|
872
|
-
To customize the leap itself, see the [`leap_max_of_curve_component`[..] &
|
|
873
|
-
`[
|
|
874
|
-
|
|
928
|
+
|
|
929
|
+
To customize the leap itself, see the [`leap_max_of_curve_component`][..] &
|
|
930
|
+
`*leap_velocity_multiplier` ([`zoom_leap_velocity_multiplier`][..],
|
|
931
|
+
[`pan_leap_velocity_multiplier`][..] and [`rotate_leap_velocity_multiplier`][..])
|
|
932
|
+
properties.
|
|
933
|
+
|
|
875
934
|
Set to `None` to disable leaping.
|
|
876
935
|
"""
|
|
877
936
|
|
|
@@ -881,7 +940,8 @@ class KeyboardConfiguration:
|
|
|
881
940
|
Disable keyboard control of the map.
|
|
882
941
|
|
|
883
942
|
Info:
|
|
884
|
-
`CursorKeyboardRotationConfiguration` may still be active,
|
|
943
|
+
[`CursorKeyboardRotationConfiguration`][(p).] may still be active,
|
|
944
|
+
and is not disabled if this is disabled.
|
|
885
945
|
"""
|
|
886
946
|
return KeyboardConfiguration(
|
|
887
947
|
enable_arrow_keys_panning=False,
|
|
@@ -901,7 +961,8 @@ class CursorRotationBehaviour(Enum):
|
|
|
901
961
|
|
|
902
962
|
OFFSET = "offset"
|
|
903
963
|
"""
|
|
904
|
-
Offset the current rotation of the map to the angle at which the
|
|
964
|
+
Offset the current rotation of the map to the angle at which the
|
|
965
|
+
user drags their cursor.
|
|
905
966
|
"""
|
|
906
967
|
|
|
907
968
|
SET_NORTH = "setNorth"
|
|
@@ -922,17 +983,19 @@ class CursorKeyboardRotationConfiguration:
|
|
|
922
983
|
|
|
923
984
|
set_north_on_click: bool = True
|
|
924
985
|
"""
|
|
925
|
-
Whether to set the North of the map to the clicked angle,
|
|
926
|
-
when the user clicks their mouse without dragging
|
|
927
|
-
(a `on_pointer_down` event followed by `on_pointer_up`
|
|
986
|
+
Whether to set the North of the map to the clicked angle,
|
|
987
|
+
when the user clicks their mouse without dragging
|
|
988
|
+
(a `on_pointer_down` event followed by `on_pointer_up`
|
|
989
|
+
without a change in rotation).
|
|
928
990
|
"""
|
|
929
991
|
|
|
930
992
|
behavior: CursorRotationBehaviour = CursorRotationBehaviour.OFFSET
|
|
931
993
|
"""
|
|
932
994
|
The behaviour of the cursor/keyboard rotation function in terms of the
|
|
933
995
|
angle that the map is rotated to.
|
|
934
|
-
|
|
935
|
-
Does not disable cursor/keyboard rotation, or
|
|
996
|
+
|
|
997
|
+
Does not disable cursor/keyboard rotation, or
|
|
998
|
+
adjust its triggers: see `is_key_trriger`.
|
|
936
999
|
"""
|
|
937
1000
|
|
|
938
1001
|
# TODO
|