flet-map 0.1.0.dev2__py3-none-any.whl → 0.2.0.dev42__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 +30 -19
- flet_map/circle_layer.py +46 -139
- flet_map/map.py +462 -604
- flet_map/map_layer.py +14 -20
- flet_map/marker_layer.py +83 -169
- flet_map/polygon_layer.py +95 -232
- flet_map/polyline_layer.py +85 -262
- flet_map/rich_attribution.py +48 -126
- flet_map/simple_attribution.py +24 -75
- flet_map/source_attribution.py +73 -0
- flet_map/tile_layer.py +224 -266
- flet_map/types.py +953 -0
- flet_map-0.2.0.dev42.dist-info/METADATA +66 -0
- flet_map-0.2.0.dev42.dist-info/RECORD +35 -0
- {flet_map-0.1.0.dev2.dist-info → flet_map-0.2.0.dev42.dist-info}/WHEEL +1 -1
- flet_map-0.2.0.dev42.dist-info/licenses/LICENSE +201 -0
- flutter/flet_map/CHANGELOG.md +4 -0
- flutter/flet_map/lib/flet_map.dart +1 -1
- flutter/flet_map/lib/src/circle_layer.dart +15 -25
- flutter/flet_map/lib/src/extension.dart +37 -0
- flutter/flet_map/lib/src/map.dart +93 -105
- flutter/flet_map/lib/src/marker_layer.dart +21 -33
- flutter/flet_map/lib/src/polygon_layer.dart +32 -52
- flutter/flet_map/lib/src/polyline_layer.dart +41 -64
- flutter/flet_map/lib/src/rich_attribution.dart +34 -34
- flutter/flet_map/lib/src/simple_attribution.dart +9 -23
- flutter/flet_map/lib/src/tile_layer.dart +47 -60
- flutter/flet_map/lib/src/utils/attribution_alignment.dart +1 -3
- flutter/flet_map/lib/src/utils/map.dart +257 -203
- flutter/flet_map/pubspec.lock +179 -130
- flutter/flet_map/pubspec.yaml +10 -5
- flet_map/text_source_attribution.py +0 -87
- flet_map-0.1.0.dev2.dist-info/METADATA +0 -168
- flet_map-0.1.0.dev2.dist-info/RECORD +0 -34
- flutter/flet_map/lib/src/create_control.dart +0 -70
- flutter/flet_map/lib/src/text_source_attribution.dart +0 -29
- {flet_map-0.1.0.dev2.dist-info → flet_map-0.2.0.dev42.dist-info}/top_level.txt +0 -0
|
@@ -1,280 +1,334 @@
|
|
|
1
|
-
import 'dart:convert';
|
|
2
|
-
|
|
3
1
|
import 'package:collection/collection.dart';
|
|
4
2
|
import 'package:flet/flet.dart';
|
|
5
3
|
import 'package:flutter/gestures.dart';
|
|
6
4
|
import 'package:flutter/material.dart';
|
|
5
|
+
import 'package:flutter/services.dart';
|
|
7
6
|
import 'package:flutter_map/flutter_map.dart';
|
|
8
7
|
import 'package:latlong2/latlong.dart';
|
|
9
8
|
|
|
10
|
-
LatLng? parseLatLng(
|
|
11
|
-
|
|
12
|
-
if (v == null) {
|
|
13
|
-
return defValue;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
final j1 = json.decode(v);
|
|
17
|
-
return latLngFromJson(j1, defValue);
|
|
18
|
-
}
|
|
9
|
+
LatLng? parseLatLng(dynamic value, [LatLng? defaultValue]) {
|
|
10
|
+
if (value == null) return defaultValue;
|
|
19
11
|
|
|
20
|
-
LatLng? latLngFromJson(Map<String, dynamic>? j, [LatLng? defValue]) {
|
|
21
|
-
if (j == null) {
|
|
22
|
-
return defValue;
|
|
23
|
-
}
|
|
24
12
|
return LatLng(
|
|
25
|
-
parseDouble(
|
|
13
|
+
parseDouble(value['latitude'], 0)!, parseDouble(value['longitude'], 0)!);
|
|
26
14
|
}
|
|
27
15
|
|
|
28
|
-
LatLngBounds? parseLatLngBounds(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
final j1 = json.decode(v);
|
|
36
|
-
return latLngBoundsFromJson(j1, defValue);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
LatLngBounds? latLngBoundsFromJson(Map<String, dynamic>? j,
|
|
40
|
-
[LatLngBounds? defValue]) {
|
|
41
|
-
if (j == null ||
|
|
42
|
-
j['corner_1'] == null ||
|
|
43
|
-
j['corner_2'] == null ||
|
|
44
|
-
latLngFromJson(j['corner_1']) == null ||
|
|
45
|
-
latLngFromJson(j['corner_2']) == null) {
|
|
46
|
-
return defValue;
|
|
16
|
+
LatLngBounds? parseLatLngBounds(dynamic value, [LatLngBounds? defaultValue]) {
|
|
17
|
+
if (value == null ||
|
|
18
|
+
value['corner_1'] == null ||
|
|
19
|
+
value['corner_2'] == null ||
|
|
20
|
+
parseLatLng(value['corner_1']) == null ||
|
|
21
|
+
parseLatLng(value['corner_2']) == null) {
|
|
22
|
+
return defaultValue;
|
|
47
23
|
}
|
|
48
24
|
return LatLngBounds(
|
|
49
|
-
|
|
25
|
+
parseLatLng(value['corner_1'])!, parseLatLng(value['corner_2'])!);
|
|
50
26
|
}
|
|
51
27
|
|
|
52
|
-
PatternFit? parsePatternFit(String? value,
|
|
53
|
-
|
|
54
|
-
if (value == null) {
|
|
55
|
-
return defValue;
|
|
56
|
-
}
|
|
28
|
+
PatternFit? parsePatternFit(String? value, [PatternFit? defaultValue]) {
|
|
29
|
+
if (value == null) return defaultValue;
|
|
57
30
|
return PatternFit.values.firstWhereOrNull(
|
|
58
31
|
(e) => e.name.toLowerCase() == value.toLowerCase()) ??
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
StrokePattern? parseStrokePattern(Control control, String propName,
|
|
63
|
-
[StrokePattern? defValue]) {
|
|
64
|
-
var v = control.attrString(propName, null);
|
|
65
|
-
if (v == null) {
|
|
66
|
-
return defValue;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
final j1 = json.decode(v);
|
|
70
|
-
return strokePatternFromJson(j1, defValue);
|
|
32
|
+
defaultValue;
|
|
71
33
|
}
|
|
72
34
|
|
|
73
|
-
StrokePattern?
|
|
74
|
-
[StrokePattern?
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (j['type'] == 'dotted') {
|
|
35
|
+
StrokePattern? parseStrokePattern(dynamic value,
|
|
36
|
+
[StrokePattern? defaultValue]) {
|
|
37
|
+
if (value == null) return defaultValue;
|
|
38
|
+
final type = value['_type'];
|
|
39
|
+
if (type == 'dotted') {
|
|
79
40
|
return StrokePattern.dotted(
|
|
80
|
-
spacingFactor: parseDouble(
|
|
81
|
-
patternFit: parsePatternFit(
|
|
41
|
+
spacingFactor: parseDouble(value['spacing_factor'], 1.5)!,
|
|
42
|
+
patternFit: parsePatternFit(value['pattern_fit'], PatternFit.scaleUp)!,
|
|
82
43
|
);
|
|
83
|
-
} else if (
|
|
44
|
+
} else if (type == 'solid') {
|
|
84
45
|
return const StrokePattern.solid();
|
|
85
|
-
} else if (
|
|
86
|
-
var segments =
|
|
46
|
+
} else if (type == 'dashed') {
|
|
47
|
+
var segments = value['segments'] ?? [];
|
|
87
48
|
return StrokePattern.dashed(
|
|
88
|
-
patternFit: parsePatternFit(
|
|
89
|
-
segments: segments
|
|
90
|
-
? (jsonDecode(segments) as List)
|
|
91
|
-
.map((e) => parseDouble(e))
|
|
92
|
-
.whereNotNull()
|
|
93
|
-
.toList()
|
|
94
|
-
: [],
|
|
49
|
+
patternFit: parsePatternFit(value['pattern_fit'], PatternFit.scaleUp)!,
|
|
50
|
+
segments: segments.map((e) => parseDouble(e)).nonNulls.toList(),
|
|
95
51
|
);
|
|
96
52
|
}
|
|
97
|
-
return
|
|
53
|
+
return defaultValue;
|
|
98
54
|
}
|
|
99
55
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
56
|
+
TileDisplay? parseTileDisplay(dynamic value, [TileDisplay? defaultValue]) {
|
|
57
|
+
if (value == null) return defaultValue;
|
|
58
|
+
final type = value['_type'];
|
|
59
|
+
if (type == 'instantaneous') {
|
|
60
|
+
return TileDisplay.instantaneous(
|
|
61
|
+
opacity: parseDouble(value['opacity'], 1.0)!,
|
|
62
|
+
);
|
|
63
|
+
} else if (type == 'fadein') {
|
|
64
|
+
return TileDisplay.fadeIn(
|
|
65
|
+
startOpacity: parseDouble(value['start_opacity'], 1.0)!,
|
|
66
|
+
reloadStartOpacity: parseDouble(value['reload_start_opacity'], 1.0)!,
|
|
67
|
+
duration:
|
|
68
|
+
parseDuration(value['duration'], const Duration(milliseconds: 100))!,
|
|
69
|
+
);
|
|
105
70
|
}
|
|
106
|
-
|
|
107
|
-
return interactionOptionsFromJSON(j1, defValue);
|
|
71
|
+
return defaultValue;
|
|
108
72
|
}
|
|
109
73
|
|
|
110
|
-
InteractionOptions?
|
|
111
|
-
[InteractionOptions?
|
|
112
|
-
if (
|
|
113
|
-
return defValue;
|
|
114
|
-
}
|
|
74
|
+
InteractionOptions? parseInteractionOptions(dynamic value,
|
|
75
|
+
[InteractionOptions? defaultValue]) {
|
|
76
|
+
if (value == null) return defaultValue;
|
|
115
77
|
return InteractionOptions(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
78
|
+
enableMultiFingerGestureRace:
|
|
79
|
+
parseBool(value["enable_multi_finger_gesture_race"], false)!,
|
|
80
|
+
pinchMoveThreshold: parseDouble(
|
|
81
|
+
value["pinch_move_threshold"],
|
|
82
|
+
)!,
|
|
83
|
+
scrollWheelVelocity: parseDouble(value["scroll_wheel_velocity"], 0.005)!,
|
|
84
|
+
pinchZoomThreshold: parseDouble(value["pinch_zoom_threshold"], 0.5)!,
|
|
85
|
+
rotationThreshold: parseDouble(value["rotation_threshold"], 20.0)!,
|
|
86
|
+
flags: parseInt(value["flags"], InteractiveFlag.all)!,
|
|
87
|
+
rotationWinGestures:
|
|
88
|
+
parseInt(value["rotation_win_gestures"], MultiFingerGesture.rotate)!,
|
|
89
|
+
pinchMoveWinGestures: parseInt(value["pinch_move_win_gestures"],
|
|
90
|
+
MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove)!,
|
|
91
|
+
pinchZoomWinGestures: parseInt(value["pinch_zoom_win_gestures"],
|
|
92
|
+
MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove)!,
|
|
93
|
+
keyboardOptions: parseKeyboardOptions(
|
|
94
|
+
value["keyboard_configuration"], const KeyboardOptions())!,
|
|
95
|
+
cursorKeyboardRotationOptions: parseCursorKeyboardRotationOptions(
|
|
96
|
+
value["cursor_keyboard_rotation_configuration"],
|
|
97
|
+
const CursorKeyboardRotationOptions())!,
|
|
98
|
+
);
|
|
129
99
|
}
|
|
130
100
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
101
|
+
CameraFit? parseCameraFit(dynamic value, [CameraFit? defaultValue]) {
|
|
102
|
+
if (value == null) return defaultValue;
|
|
103
|
+
|
|
104
|
+
final bounds = parseLatLngBounds(value["bounds"]);
|
|
105
|
+
final coordinates = (value["coordinates"] as List?)
|
|
106
|
+
?.map((c) => parseLatLng(c))
|
|
107
|
+
.nonNulls
|
|
108
|
+
.toList();
|
|
109
|
+
if (bounds == null && coordinates == null) return defaultValue;
|
|
110
|
+
|
|
111
|
+
final forceIntegerZoomLevel =
|
|
112
|
+
parseBool(value["force_integer_zoom_level"], false)!;
|
|
113
|
+
final maxZoom = parseDouble(value["max_zoom"]);
|
|
114
|
+
final minZoom = parseDouble(value["min_zoom"], 0)!;
|
|
115
|
+
final padding = parsePadding(value["padding"], EdgeInsets.zero)!;
|
|
116
|
+
if (bounds != null) {
|
|
117
|
+
return CameraFit.insideBounds(
|
|
118
|
+
bounds: bounds,
|
|
119
|
+
forceIntegerZoomLevel: forceIntegerZoomLevel,
|
|
120
|
+
maxZoom: maxZoom,
|
|
121
|
+
minZoom: minZoom,
|
|
122
|
+
padding: padding,
|
|
123
|
+
);
|
|
124
|
+
} else {
|
|
125
|
+
return CameraFit.coordinates(
|
|
126
|
+
coordinates: coordinates!,
|
|
127
|
+
forceIntegerZoomLevel: forceIntegerZoomLevel,
|
|
128
|
+
maxZoom: maxZoom,
|
|
129
|
+
minZoom: minZoom,
|
|
130
|
+
padding: padding,
|
|
131
|
+
);
|
|
135
132
|
}
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
KeyboardOptions? parseKeyboardOptions(dynamic value,
|
|
136
|
+
[KeyboardOptions? defaultValue]) {
|
|
137
|
+
if (value == null) return defaultValue;
|
|
138
|
+
return KeyboardOptions(
|
|
139
|
+
autofocus: parseBool(value["autofocus"], true)!,
|
|
140
|
+
animationCurveDuration: parseDuration(value["animation_curve_duration"],
|
|
141
|
+
const Duration(milliseconds: 450))!,
|
|
142
|
+
animationCurveCurve:
|
|
143
|
+
parseCurve(value["animation_curve_curve"], Curves.easeInOut)!,
|
|
144
|
+
enableArrowKeysPanning:
|
|
145
|
+
parseBool(value["enable_arrow_keys_panning"], true)!,
|
|
146
|
+
enableQERotating: parseBool(value["enable_qe_rotating"], true)!,
|
|
147
|
+
enableRFZooming: parseBool(value["enable_rf_zooming"], true)!,
|
|
148
|
+
enableWASDPanning: parseBool(value["enable_wasd_panning"], true)!,
|
|
149
|
+
leapMaxOfCurveComponent:
|
|
150
|
+
parseDouble(value["leap_max_of_curve_component"], 0.6)!,
|
|
151
|
+
// maxPanVelocity: ,
|
|
152
|
+
maxRotateVelocity: parseDouble(value["max_rotate_velocity"], 3)!,
|
|
153
|
+
maxZoomVelocity: parseDouble(value["max_zoom_velocity"], 0.03)!,
|
|
154
|
+
panLeapVelocityMultiplier:
|
|
155
|
+
parseDouble(value["pan_leap_velocity_multiplier"], 5)!,
|
|
156
|
+
rotateLeapVelocityMultiplier:
|
|
157
|
+
parseDouble(value["rotate_leap_velocity_multiplier"], 3)!,
|
|
158
|
+
zoomLeapVelocityMultiplier:
|
|
159
|
+
parseDouble(value["zoom_leap_velocity_multiplier"], 3)!,
|
|
160
|
+
performLeapTriggerDuration: parseDuration(value["perform_leap_trigger_duration"]),
|
|
161
|
+
animationCurveReverseDuration: parseDuration(value["animation_curve_reverse_duration"]));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
CursorRotationBehaviour? parseCursorRotationBehaviour(String? value,
|
|
165
|
+
[CursorRotationBehaviour? defValue]) {
|
|
166
|
+
if (value == null) return defValue;
|
|
167
|
+
return CursorRotationBehaviour.values.firstWhereOrNull(
|
|
168
|
+
(e) => e.name.toLowerCase() == value.toLowerCase()) ??
|
|
138
169
|
defValue;
|
|
139
170
|
}
|
|
140
171
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
CursorKeyboardRotationOptions? parseCursorKeyboardRotationOptions(dynamic value,
|
|
173
|
+
[CursorKeyboardRotationOptions? defaultValue]) {
|
|
174
|
+
if (value == null) return defaultValue;
|
|
175
|
+
return CursorKeyboardRotationOptions(
|
|
176
|
+
setNorthOnClick: parseBool(value["set_north_on_click"], true)!,
|
|
177
|
+
behaviour: parseCursorRotationBehaviour(
|
|
178
|
+
value["behaviour"], CursorRotationBehaviour.offset)!,
|
|
179
|
+
isKeyTrigger: (LogicalKeyboardKey key) {
|
|
180
|
+
return (value["trigger_keys"] as List).contains(key);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
151
183
|
|
|
152
|
-
|
|
153
|
-
|
|
184
|
+
// Crs? parseCrs(dynamic value, [Crs? defaultValue]) {
|
|
185
|
+
// if (value == null) return defaultValue;
|
|
186
|
+
// return Crs();
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// MapCamera? parseMapCamera(dynamic value, [MapCamera? defaultValue]) {
|
|
190
|
+
// if (value == null) return defaultValue;
|
|
191
|
+
// return MapCamera(
|
|
192
|
+
// crs: Crs(),
|
|
193
|
+
// center: parseLatLng(value["center"])!,
|
|
194
|
+
// zoom: parseDouble(value["zoom"], 0)!,
|
|
195
|
+
// minZoom: parseDouble(value["min_zoom"], 0)!,
|
|
196
|
+
// maxZoom: parseDouble(value["max_zoom"], 0)!,
|
|
197
|
+
// rotation: parseDouble(value["rotation"], 0)!,
|
|
198
|
+
// bounds: parseLatLngBounds(value["bounds"]),
|
|
199
|
+
// );
|
|
200
|
+
// }
|
|
201
|
+
|
|
202
|
+
EvictErrorTileStrategy? parseEvictErrorTileStrategy(String? value,
|
|
203
|
+
[EvictErrorTileStrategy? defaultValue]) {
|
|
204
|
+
if (value == null) return defaultValue;
|
|
205
|
+
return EvictErrorTileStrategy.values.firstWhereOrNull(
|
|
206
|
+
(e) => e.name.toLowerCase() == value.toLowerCase()) ??
|
|
207
|
+
defaultValue;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
extension TapPositionExtension on TapPosition {
|
|
211
|
+
Map<String, dynamic> toMap() => {
|
|
212
|
+
"gx": global.dx,
|
|
213
|
+
"gy": global.dy,
|
|
214
|
+
"lx": relative?.dx,
|
|
215
|
+
"ly": relative?.dy,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
154
218
|
|
|
219
|
+
extension LatLngExtension on LatLng {
|
|
220
|
+
Map<String, dynamic> toMap() => {
|
|
221
|
+
"latitude": latitude,
|
|
222
|
+
"longitude": longitude,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
extension LatLngBoundsExtension on LatLngBounds {
|
|
227
|
+
// TODO
|
|
228
|
+
// Map<String, dynamic> toMap() => {
|
|
229
|
+
//
|
|
230
|
+
// };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
extension MapCameraExtension on MapCamera {
|
|
234
|
+
Map<String, dynamic> toMap() => {
|
|
235
|
+
"center": center.toMap(),
|
|
236
|
+
"zoom": zoom,
|
|
237
|
+
"min_zoom": minZoom,
|
|
238
|
+
"max_zoom": maxZoom,
|
|
239
|
+
"rotation": rotation,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
extension MapEventExtension on MapEvent {
|
|
244
|
+
Map<String, dynamic> toMap() => {
|
|
245
|
+
"source": source.name,
|
|
246
|
+
"camera": camera.toMap(),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
MapOptions? parseConfiguration(Control control, BuildContext context,
|
|
251
|
+
[MapOptions? defaultValue]) {
|
|
155
252
|
return MapOptions(
|
|
156
253
|
initialCenter:
|
|
157
|
-
parseLatLng(control
|
|
254
|
+
parseLatLng(control.get("initial_center"), const LatLng(50.5, 30.51))!,
|
|
158
255
|
interactionOptions: parseInteractionOptions(
|
|
159
|
-
control
|
|
160
|
-
backgroundColor:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
onPointerHover: control.
|
|
256
|
+
control.get("interaction_configuration"), const InteractionOptions())!,
|
|
257
|
+
backgroundColor: control.getColor("bgcolor", context, Colors.grey[300])!,
|
|
258
|
+
initialRotation: control.getDouble("initial_rotation", 0.0)!,
|
|
259
|
+
initialZoom: control.getDouble("initial_zoom", 13.0)!,
|
|
260
|
+
keepAlive: control.getBool("keep_alive", false)!,
|
|
261
|
+
maxZoom: control.getDouble("max_zoom"),
|
|
262
|
+
minZoom: control.getDouble("min_zoom"),
|
|
263
|
+
initialCameraFit: parseCameraFit(control.get("initial_camera_fit")),
|
|
264
|
+
onPointerHover: control.getBool("on_hover", false)!
|
|
168
265
|
? (PointerHoverEvent e, LatLng latlng) {
|
|
169
|
-
triggerEvent("hover", {
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
"gx": e.position.dx,
|
|
173
|
-
"gy": e.position.dy,
|
|
174
|
-
"lx": e.localPosition.dx,
|
|
175
|
-
"ly": e.localPosition.dy,
|
|
176
|
-
"kind": e.kind.name,
|
|
266
|
+
control.triggerEvent("hover", {
|
|
267
|
+
"coordinates": latlng.toMap(),
|
|
268
|
+
...e.toMap(),
|
|
177
269
|
});
|
|
178
270
|
}
|
|
179
271
|
: null,
|
|
180
|
-
onTap: control.
|
|
272
|
+
onTap: control.getBool("on_tap", false)!
|
|
181
273
|
? (TapPosition pos, LatLng latlng) {
|
|
182
|
-
triggerEvent("tap", {
|
|
183
|
-
"
|
|
184
|
-
|
|
185
|
-
"gx": pos.global.dx,
|
|
186
|
-
"gy": pos.global.dy,
|
|
187
|
-
"lx": pos.relative?.dx,
|
|
188
|
-
"ly": pos.relative?.dy,
|
|
274
|
+
control.triggerEvent("tap", {
|
|
275
|
+
"coordinates": latlng.toMap(),
|
|
276
|
+
...pos.toMap(),
|
|
189
277
|
});
|
|
190
278
|
}
|
|
191
279
|
: null,
|
|
192
|
-
onLongPress: control.
|
|
280
|
+
onLongPress: control.getBool("on_long_press", false)!
|
|
193
281
|
? (TapPosition pos, LatLng latlng) {
|
|
194
|
-
triggerEvent("long_press", {
|
|
195
|
-
"
|
|
196
|
-
|
|
197
|
-
"gx": pos.global.dx,
|
|
198
|
-
"gy": pos.global.dy,
|
|
199
|
-
"lx": pos.relative?.dx,
|
|
200
|
-
"ly": pos.relative?.dy,
|
|
282
|
+
control.triggerEvent("long_press", {
|
|
283
|
+
"coordinates": latlng.toMap(),
|
|
284
|
+
...pos.toMap(),
|
|
201
285
|
});
|
|
202
286
|
}
|
|
203
287
|
: null,
|
|
204
|
-
onPositionChanged: control.
|
|
288
|
+
onPositionChanged: control.getBool("on_position_change", false)!
|
|
205
289
|
? (MapCamera camera, bool hasGesture) {
|
|
206
|
-
triggerEvent("position_change", {
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"max_zoom": camera.maxZoom,
|
|
211
|
-
"rot": camera.rotation,
|
|
290
|
+
control.triggerEvent("position_change", {
|
|
291
|
+
"coordinates": camera.center.toMap(),
|
|
292
|
+
"has_gesture": hasGesture,
|
|
293
|
+
"camera": camera.toMap()
|
|
212
294
|
});
|
|
213
295
|
}
|
|
214
296
|
: null,
|
|
215
|
-
onPointerDown: control.
|
|
297
|
+
onPointerDown: control.getBool("on_pointer_down", false)!
|
|
216
298
|
? (PointerDownEvent e, LatLng latlng) {
|
|
217
|
-
triggerEvent("pointer_down", {
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
"gx": e.position.dx,
|
|
221
|
-
"gy": e.position.dy,
|
|
222
|
-
"kind": e.kind.name,
|
|
299
|
+
control.triggerEvent("pointer_down", {
|
|
300
|
+
"coordinates": latlng.toMap(),
|
|
301
|
+
...e.toMap(),
|
|
223
302
|
});
|
|
224
303
|
}
|
|
225
304
|
: null,
|
|
226
|
-
onPointerCancel: control.
|
|
305
|
+
onPointerCancel: control.getBool("on_pointer_cancel", false)!
|
|
227
306
|
? (PointerCancelEvent e, LatLng latlng) {
|
|
228
|
-
triggerEvent("pointer_cancel", {
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
"gx": e.position.dx,
|
|
232
|
-
"gy": e.position.dy,
|
|
233
|
-
"kind": e.kind.name,
|
|
307
|
+
control.triggerEvent("pointer_cancel", {
|
|
308
|
+
"coordinates": latlng.toMap(),
|
|
309
|
+
...e.toMap(),
|
|
234
310
|
});
|
|
235
311
|
}
|
|
236
312
|
: null,
|
|
237
|
-
onPointerUp: control.
|
|
313
|
+
onPointerUp: control.getBool("on_pointer_up", false)!
|
|
238
314
|
? (PointerUpEvent e, LatLng latlng) {
|
|
239
|
-
triggerEvent(
|
|
240
|
-
|
|
241
|
-
"long": latlng.longitude,
|
|
242
|
-
"gx": e.position.dx,
|
|
243
|
-
"gy": e.position.dy,
|
|
244
|
-
"kind": e.kind.name,
|
|
245
|
-
});
|
|
315
|
+
control.triggerEvent(
|
|
316
|
+
"pointer_up", {"coordinates": latlng.toMap(), ...e.toMap()});
|
|
246
317
|
}
|
|
247
318
|
: null,
|
|
248
|
-
onSecondaryTap: control.
|
|
319
|
+
onSecondaryTap: control.getBool("on_secondary_tap", false)!
|
|
249
320
|
? (TapPosition pos, LatLng latlng) {
|
|
250
|
-
triggerEvent("secondary_tap", {
|
|
251
|
-
"
|
|
252
|
-
|
|
253
|
-
"gx": pos.global.dx,
|
|
254
|
-
"gy": pos.global.dy,
|
|
255
|
-
"lx": pos.relative?.dx,
|
|
256
|
-
"ly": pos.relative?.dy,
|
|
321
|
+
control.triggerEvent("secondary_tap", {
|
|
322
|
+
"coordinates": latlng.toMap(),
|
|
323
|
+
...pos.toMap(),
|
|
257
324
|
});
|
|
258
325
|
}
|
|
259
326
|
: null,
|
|
260
|
-
onMapEvent: control.
|
|
261
|
-
? (MapEvent e)
|
|
262
|
-
triggerEvent("event", {
|
|
263
|
-
"src": e.source.name,
|
|
264
|
-
"c_lat": e.camera.center.latitude,
|
|
265
|
-
"c_long": e.camera.center.longitude,
|
|
266
|
-
"zoom": e.camera.zoom,
|
|
267
|
-
"min_zoom": e.camera.minZoom,
|
|
268
|
-
"max_zoom": e.camera.maxZoom,
|
|
269
|
-
"rot": e.camera.rotation,
|
|
270
|
-
});
|
|
271
|
-
}
|
|
327
|
+
onMapEvent: control.getBool("on_event", false)!
|
|
328
|
+
? (MapEvent e) => control.triggerEvent("event", e.toMap())
|
|
272
329
|
: null,
|
|
273
|
-
onMapReady: control.
|
|
274
|
-
? ()
|
|
275
|
-
debugPrint("Map ${control.id} init");
|
|
276
|
-
backend.triggerControlEvent(control.id, "init");
|
|
277
|
-
}
|
|
330
|
+
onMapReady: control.getBool("on_init", false)!
|
|
331
|
+
? () => control.triggerEvent("init")
|
|
278
332
|
: null,
|
|
279
333
|
);
|
|
280
334
|
}
|