react-map4d-map 1.3.2 → 1.3.4
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.
- package/dist/components/MFBuilding.d.ts +1 -1
- package/dist/components/MFCircle.d.ts +1 -1
- package/dist/components/MFMarker.d.ts +1 -1
- package/dist/components/MFPOI.d.ts +1 -1
- package/dist/components/MFPolygon.d.ts +1 -1
- package/dist/components/MFPolyline.d.ts +1 -1
- package/dist/index.js +621 -178
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +621 -178
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.modern.js
CHANGED
|
@@ -13,27 +13,28 @@ var MarkerClusterContext = createContext(markerClusterDefaultContext);
|
|
|
13
13
|
|
|
14
14
|
var MFBuilding = function MFBuilding(props) {
|
|
15
15
|
var position = props.position,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
name = props.name,
|
|
17
|
+
scale = props.scale,
|
|
18
|
+
bearing = props.bearing,
|
|
19
|
+
elevation = props.elevation,
|
|
20
|
+
height = props.height,
|
|
21
|
+
model = props.model,
|
|
22
|
+
texture = props.texture,
|
|
23
|
+
coordinates = props.coordinates,
|
|
24
|
+
visible = props.visible,
|
|
25
|
+
draggable = props.draggable,
|
|
26
|
+
clickable = props.clickable,
|
|
27
|
+
selected = props.selected,
|
|
28
|
+
growUp = props.growUp,
|
|
29
|
+
map = props.map,
|
|
30
|
+
onCreated = props.onCreated;
|
|
31
31
|
var map4dContext = useContext(Map4dContext);
|
|
32
32
|
var theMap = map || map4dContext.map;
|
|
33
33
|
var buildingRef = useRef(null);
|
|
34
34
|
useEffect(function () {
|
|
35
35
|
if (theMap && !buildingRef.current && (coordinates && (coordinates === null || coordinates === void 0 ? void 0 : coordinates.length) > 0 || model)) {
|
|
36
36
|
var _buildingRef$current;
|
|
37
|
+
|
|
37
38
|
var option = {
|
|
38
39
|
position: position || {
|
|
39
40
|
lat: 10.793113,
|
|
@@ -49,7 +50,7 @@ var MFBuilding = function MFBuilding(props) {
|
|
|
49
50
|
coordinates: coordinates,
|
|
50
51
|
visible: visible,
|
|
51
52
|
draggable: draggable,
|
|
52
|
-
|
|
53
|
+
clickable: clickable,
|
|
53
54
|
selected: selected,
|
|
54
55
|
growUp: growUp
|
|
55
56
|
};
|
|
@@ -66,75 +67,93 @@ var MFBuilding = function MFBuilding(props) {
|
|
|
66
67
|
useEffect(function () {
|
|
67
68
|
if (theMap) {
|
|
68
69
|
var _buildingRef$current2;
|
|
70
|
+
|
|
69
71
|
(_buildingRef$current2 = buildingRef.current) === null || _buildingRef$current2 === void 0 ? void 0 : _buildingRef$current2.setMap(theMap);
|
|
70
72
|
}
|
|
73
|
+
|
|
71
74
|
return function () {
|
|
72
75
|
var _buildingRef$current3;
|
|
76
|
+
|
|
73
77
|
(_buildingRef$current3 = buildingRef.current) === null || _buildingRef$current3 === void 0 ? void 0 : _buildingRef$current3.setMap(null);
|
|
74
78
|
};
|
|
75
79
|
}, [theMap]);
|
|
76
80
|
useEffect(function () {
|
|
77
81
|
return function () {
|
|
78
82
|
var _buildingRef$current4;
|
|
83
|
+
|
|
79
84
|
(_buildingRef$current4 = buildingRef.current) === null || _buildingRef$current4 === void 0 ? void 0 : _buildingRef$current4.setMap(null);
|
|
80
85
|
};
|
|
81
86
|
}, []);
|
|
82
87
|
useEffect(function () {
|
|
83
88
|
var _buildingRef$current5;
|
|
89
|
+
|
|
84
90
|
(_buildingRef$current5 = buildingRef.current) === null || _buildingRef$current5 === void 0 ? void 0 : _buildingRef$current5.setPosition(position);
|
|
85
91
|
}, [position]);
|
|
86
92
|
useEffect(function () {
|
|
87
93
|
var _buildingRef$current6;
|
|
94
|
+
|
|
88
95
|
name != undefined && ((_buildingRef$current6 = buildingRef.current) === null || _buildingRef$current6 === void 0 ? void 0 : _buildingRef$current6.setName(name));
|
|
89
96
|
}, [name]);
|
|
90
97
|
useEffect(function () {
|
|
91
98
|
var _buildingRef$current7;
|
|
99
|
+
|
|
92
100
|
scale != undefined && ((_buildingRef$current7 = buildingRef.current) === null || _buildingRef$current7 === void 0 ? void 0 : _buildingRef$current7.setScale(scale));
|
|
93
101
|
}, [scale]);
|
|
94
102
|
useEffect(function () {
|
|
95
103
|
if (bearing != undefined) {
|
|
96
104
|
var _buildingRef$current8;
|
|
105
|
+
|
|
97
106
|
(_buildingRef$current8 = buildingRef.current) === null || _buildingRef$current8 === void 0 ? void 0 : _buildingRef$current8.setBearing(bearing);
|
|
98
107
|
}
|
|
99
108
|
}, [bearing]);
|
|
100
109
|
useEffect(function () {
|
|
101
110
|
var _buildingRef$current9;
|
|
111
|
+
|
|
102
112
|
elevation != undefined && ((_buildingRef$current9 = buildingRef.current) === null || _buildingRef$current9 === void 0 ? void 0 : _buildingRef$current9.setElevation(elevation));
|
|
103
113
|
}, [elevation]);
|
|
104
114
|
useEffect(function () {
|
|
105
115
|
var _buildingRef$current10;
|
|
116
|
+
|
|
106
117
|
height != undefined && ((_buildingRef$current10 = buildingRef.current) === null || _buildingRef$current10 === void 0 ? void 0 : _buildingRef$current10.setHeight(height));
|
|
107
118
|
}, [height]);
|
|
108
119
|
useEffect(function () {
|
|
109
120
|
var _buildingRef$current11;
|
|
121
|
+
|
|
110
122
|
model != undefined && ((_buildingRef$current11 = buildingRef.current) === null || _buildingRef$current11 === void 0 ? void 0 : _buildingRef$current11.setModel(model));
|
|
111
123
|
}, [model]);
|
|
112
124
|
useEffect(function () {
|
|
113
125
|
var _buildingRef$current12;
|
|
126
|
+
|
|
114
127
|
texture != undefined && ((_buildingRef$current12 = buildingRef.current) === null || _buildingRef$current12 === void 0 ? void 0 : _buildingRef$current12.setTexture(texture));
|
|
115
128
|
}, [texture]);
|
|
116
129
|
useEffect(function () {
|
|
117
130
|
var _buildingRef$current13;
|
|
131
|
+
|
|
118
132
|
coordinates != undefined && ((_buildingRef$current13 = buildingRef.current) === null || _buildingRef$current13 === void 0 ? void 0 : _buildingRef$current13.setCoordinates(coordinates));
|
|
119
133
|
}, [coordinates]);
|
|
120
134
|
useEffect(function () {
|
|
121
135
|
var _buildingRef$current14;
|
|
136
|
+
|
|
122
137
|
visible != undefined && ((_buildingRef$current14 = buildingRef.current) === null || _buildingRef$current14 === void 0 ? void 0 : _buildingRef$current14.setVisible(visible));
|
|
123
138
|
}, [visible]);
|
|
124
139
|
useEffect(function () {
|
|
125
140
|
var _buildingRef$current15;
|
|
141
|
+
|
|
126
142
|
draggable != undefined && ((_buildingRef$current15 = buildingRef.current) === null || _buildingRef$current15 === void 0 ? void 0 : _buildingRef$current15.setDraggable(draggable));
|
|
127
143
|
}, [draggable]);
|
|
128
144
|
useEffect(function () {
|
|
129
145
|
var _buildingRef$current16;
|
|
130
|
-
|
|
131
|
-
|
|
146
|
+
|
|
147
|
+
clickable != undefined && ((_buildingRef$current16 = buildingRef.current) === null || _buildingRef$current16 === void 0 ? void 0 : _buildingRef$current16.setClickable(clickable));
|
|
148
|
+
}, [clickable]);
|
|
132
149
|
useEffect(function () {
|
|
133
150
|
var _buildingRef$current17;
|
|
151
|
+
|
|
134
152
|
selected != undefined && ((_buildingRef$current17 = buildingRef.current) === null || _buildingRef$current17 === void 0 ? void 0 : _buildingRef$current17.setSelected(selected));
|
|
135
153
|
}, [selected]);
|
|
136
154
|
useEffect(function () {
|
|
137
155
|
var _buildingRef$current18;
|
|
156
|
+
|
|
138
157
|
growUp != undefined && ((_buildingRef$current18 = buildingRef.current) === null || _buildingRef$current18 === void 0 ? void 0 : _buildingRef$current18.setGrowUp(growUp));
|
|
139
158
|
}, [growUp]);
|
|
140
159
|
return null;
|
|
@@ -142,16 +161,18 @@ var MFBuilding = function MFBuilding(props) {
|
|
|
142
161
|
|
|
143
162
|
var MFBuildingOverlay = function MFBuildingOverlay(props) {
|
|
144
163
|
var getUrl = props.getUrl,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
164
|
+
visible = props.visible,
|
|
165
|
+
parserData = props.parserData,
|
|
166
|
+
prefixId = props.prefixId,
|
|
167
|
+
map = props.map,
|
|
168
|
+
onCreated = props.onCreated;
|
|
150
169
|
var map4dContext = useContext(Map4dContext);
|
|
151
170
|
var theMap = map || map4dContext.map;
|
|
152
171
|
var buildingOverlayRef = useRef();
|
|
172
|
+
|
|
153
173
|
var reCreate = function reCreate() {
|
|
154
174
|
var _buildingOverlayRef$c, _buildingOverlayRef$c2;
|
|
175
|
+
|
|
155
176
|
(_buildingOverlayRef$c = buildingOverlayRef.current) === null || _buildingOverlayRef$c === void 0 ? void 0 : _buildingOverlayRef$c.setMap(null);
|
|
156
177
|
var option = {
|
|
157
178
|
getUrl: getUrl || {
|
|
@@ -171,6 +192,7 @@ var MFBuildingOverlay = function MFBuildingOverlay(props) {
|
|
|
171
192
|
(_buildingOverlayRef$c2 = buildingOverlayRef.current) === null || _buildingOverlayRef$c2 === void 0 ? void 0 : _buildingOverlayRef$c2.setMap(theMap);
|
|
172
193
|
onCreated && onCreated(buildingOverlayRef.current);
|
|
173
194
|
};
|
|
195
|
+
|
|
174
196
|
useEffect(function () {
|
|
175
197
|
if (theMap && !buildingOverlayRef.current) {
|
|
176
198
|
reCreate();
|
|
@@ -179,16 +201,20 @@ var MFBuildingOverlay = function MFBuildingOverlay(props) {
|
|
|
179
201
|
useEffect(function () {
|
|
180
202
|
if (theMap) {
|
|
181
203
|
var _buildingOverlayRef$c3;
|
|
204
|
+
|
|
182
205
|
(_buildingOverlayRef$c3 = buildingOverlayRef.current) === null || _buildingOverlayRef$c3 === void 0 ? void 0 : _buildingOverlayRef$c3.setMap(theMap);
|
|
183
206
|
}
|
|
207
|
+
|
|
184
208
|
return function () {
|
|
185
209
|
var _buildingOverlayRef$c4;
|
|
210
|
+
|
|
186
211
|
(_buildingOverlayRef$c4 = buildingOverlayRef.current) === null || _buildingOverlayRef$c4 === void 0 ? void 0 : _buildingOverlayRef$c4.setMap(null);
|
|
187
212
|
};
|
|
188
213
|
}, [theMap]);
|
|
189
214
|
useEffect(function () {
|
|
190
215
|
return function () {
|
|
191
216
|
var _buildingOverlayRef$c5;
|
|
217
|
+
|
|
192
218
|
(_buildingOverlayRef$c5 = buildingOverlayRef.current) === null || _buildingOverlayRef$c5 === void 0 ? void 0 : _buildingOverlayRef$c5.setMap(null);
|
|
193
219
|
};
|
|
194
220
|
}, []);
|
|
@@ -201,33 +227,36 @@ var MFBuildingOverlay = function MFBuildingOverlay(props) {
|
|
|
201
227
|
};
|
|
202
228
|
|
|
203
229
|
var VariableTool = function VariableTool() {};
|
|
230
|
+
|
|
204
231
|
VariableTool.hasValue = function (variable) {
|
|
205
232
|
if (variable != undefined && variable != null) {
|
|
206
233
|
return true;
|
|
207
234
|
}
|
|
235
|
+
|
|
208
236
|
return false;
|
|
209
237
|
};
|
|
210
238
|
|
|
211
239
|
var MFCircle = function MFCircle(props) {
|
|
212
240
|
var center = props.center,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
241
|
+
radius = props.radius,
|
|
242
|
+
fillColor = props.fillColor,
|
|
243
|
+
fillOpacity = props.fillOpacity,
|
|
244
|
+
visible = props.visible,
|
|
245
|
+
strokeColor = props.strokeColor,
|
|
246
|
+
strokeWidth = props.strokeWidth,
|
|
247
|
+
draggable = props.draggable,
|
|
248
|
+
zIndex = props.zIndex,
|
|
249
|
+
elevation = props.elevation,
|
|
250
|
+
clickable = props.clickable,
|
|
251
|
+
map = props.map,
|
|
252
|
+
onCreated = props.onCreated;
|
|
225
253
|
var map4dContext = useContext(Map4dContext);
|
|
226
254
|
var theMap = map || map4dContext.map;
|
|
227
255
|
var circleRef = useRef();
|
|
228
256
|
useEffect(function () {
|
|
229
257
|
if (theMap && !circleRef.current) {
|
|
230
258
|
var _circleRef$current;
|
|
259
|
+
|
|
231
260
|
var option = {
|
|
232
261
|
center: center || {
|
|
233
262
|
lat: 10.793113,
|
|
@@ -242,7 +271,7 @@ var MFCircle = function MFCircle(props) {
|
|
|
242
271
|
draggable: draggable,
|
|
243
272
|
zIndex: zIndex,
|
|
244
273
|
elevation: elevation,
|
|
245
|
-
|
|
274
|
+
clickable: clickable
|
|
246
275
|
};
|
|
247
276
|
Object.keys(option).forEach(function (key) {
|
|
248
277
|
if (option[key] == undefined || option[key] == null) {
|
|
@@ -257,104 +286,123 @@ var MFCircle = function MFCircle(props) {
|
|
|
257
286
|
useEffect(function () {
|
|
258
287
|
if (theMap) {
|
|
259
288
|
var _circleRef$current2;
|
|
289
|
+
|
|
260
290
|
(_circleRef$current2 = circleRef.current) === null || _circleRef$current2 === void 0 ? void 0 : _circleRef$current2.setMap(theMap);
|
|
261
291
|
}
|
|
292
|
+
|
|
262
293
|
return function () {
|
|
263
294
|
var _circleRef$current3;
|
|
295
|
+
|
|
264
296
|
(_circleRef$current3 = circleRef.current) === null || _circleRef$current3 === void 0 ? void 0 : _circleRef$current3.setMap(null);
|
|
265
297
|
};
|
|
266
298
|
}, [theMap]);
|
|
267
299
|
useEffect(function () {
|
|
268
300
|
return function () {
|
|
269
301
|
var _circleRef$current4;
|
|
302
|
+
|
|
270
303
|
(_circleRef$current4 = circleRef.current) === null || _circleRef$current4 === void 0 ? void 0 : _circleRef$current4.setMap(null);
|
|
271
304
|
};
|
|
272
305
|
}, []);
|
|
273
306
|
useEffect(function () {
|
|
274
307
|
if (VariableTool.hasValue(center)) {
|
|
275
308
|
var _circleRef$current5;
|
|
309
|
+
|
|
276
310
|
(_circleRef$current5 = circleRef.current) === null || _circleRef$current5 === void 0 ? void 0 : _circleRef$current5.setCenter(center);
|
|
277
311
|
}
|
|
278
312
|
}, [center]);
|
|
279
313
|
useEffect(function () {
|
|
280
314
|
if (VariableTool.hasValue(radius)) {
|
|
281
315
|
var _circleRef$current6;
|
|
316
|
+
|
|
282
317
|
(_circleRef$current6 = circleRef.current) === null || _circleRef$current6 === void 0 ? void 0 : _circleRef$current6.setRadius(radius);
|
|
283
318
|
}
|
|
284
319
|
}, [radius]);
|
|
285
320
|
useEffect(function () {
|
|
286
321
|
if (VariableTool.hasValue(fillColor)) {
|
|
287
322
|
var _circleRef$current7;
|
|
323
|
+
|
|
288
324
|
(_circleRef$current7 = circleRef.current) === null || _circleRef$current7 === void 0 ? void 0 : _circleRef$current7.setFillColor(fillColor);
|
|
289
325
|
}
|
|
290
326
|
}, [fillColor]);
|
|
291
327
|
useEffect(function () {
|
|
292
328
|
if (VariableTool.hasValue(fillOpacity)) {
|
|
293
329
|
var _circleRef$current8;
|
|
330
|
+
|
|
294
331
|
(_circleRef$current8 = circleRef.current) === null || _circleRef$current8 === void 0 ? void 0 : _circleRef$current8.setFillOpacity(fillOpacity);
|
|
295
332
|
}
|
|
296
333
|
}, [fillOpacity]);
|
|
297
334
|
useEffect(function () {
|
|
298
335
|
if (VariableTool.hasValue(visible)) {
|
|
299
336
|
var _circleRef$current9;
|
|
337
|
+
|
|
300
338
|
(_circleRef$current9 = circleRef.current) === null || _circleRef$current9 === void 0 ? void 0 : _circleRef$current9.setVisible(visible);
|
|
301
339
|
}
|
|
302
340
|
}, [visible]);
|
|
303
341
|
useEffect(function () {
|
|
304
342
|
if (VariableTool.hasValue(strokeColor)) {
|
|
305
343
|
var _circleRef$current10;
|
|
344
|
+
|
|
306
345
|
(_circleRef$current10 = circleRef.current) === null || _circleRef$current10 === void 0 ? void 0 : _circleRef$current10.setStrokeColor(strokeColor);
|
|
307
346
|
}
|
|
308
347
|
}, [strokeColor]);
|
|
309
348
|
useEffect(function () {
|
|
310
349
|
if (VariableTool.hasValue(strokeWidth)) {
|
|
311
350
|
var _circleRef$current11;
|
|
351
|
+
|
|
312
352
|
(_circleRef$current11 = circleRef.current) === null || _circleRef$current11 === void 0 ? void 0 : _circleRef$current11.setStrokeWidth(strokeWidth);
|
|
313
353
|
}
|
|
314
354
|
}, [strokeWidth]);
|
|
315
355
|
useEffect(function () {
|
|
316
356
|
if (VariableTool.hasValue(draggable)) {
|
|
317
357
|
var _circleRef$current12;
|
|
358
|
+
|
|
318
359
|
(_circleRef$current12 = circleRef.current) === null || _circleRef$current12 === void 0 ? void 0 : _circleRef$current12.setDraggable(draggable);
|
|
319
360
|
}
|
|
320
361
|
}, [draggable]);
|
|
321
362
|
useEffect(function () {
|
|
322
363
|
if (VariableTool.hasValue(zIndex)) {
|
|
323
364
|
var _circleRef$current13;
|
|
365
|
+
|
|
324
366
|
(_circleRef$current13 = circleRef.current) === null || _circleRef$current13 === void 0 ? void 0 : _circleRef$current13.setZIndex(zIndex);
|
|
325
367
|
}
|
|
326
368
|
}, [zIndex]);
|
|
327
369
|
useEffect(function () {
|
|
328
370
|
if (VariableTool.hasValue(elevation)) {
|
|
329
371
|
var _circleRef$current14;
|
|
372
|
+
|
|
330
373
|
(_circleRef$current14 = circleRef.current) === null || _circleRef$current14 === void 0 ? void 0 : _circleRef$current14.setElevation(elevation);
|
|
331
374
|
}
|
|
332
375
|
}, [elevation]);
|
|
333
376
|
useEffect(function () {
|
|
334
|
-
if (VariableTool.hasValue(
|
|
377
|
+
if (VariableTool.hasValue(clickable)) {
|
|
335
378
|
var _circleRef$current15;
|
|
336
|
-
|
|
379
|
+
|
|
380
|
+
(_circleRef$current15 = circleRef.current) === null || _circleRef$current15 === void 0 ? void 0 : _circleRef$current15.setClickable(clickable);
|
|
337
381
|
}
|
|
338
|
-
}, [
|
|
382
|
+
}, [clickable]);
|
|
339
383
|
return null;
|
|
340
384
|
};
|
|
341
385
|
|
|
342
386
|
var MFDataLayer = function MFDataLayer(props) {
|
|
343
387
|
var geoJsonString = props.geoJsonString,
|
|
344
|
-
|
|
345
|
-
|
|
388
|
+
map = props.map,
|
|
389
|
+
onCreated = props.onCreated;
|
|
346
390
|
var map4dContext = useContext(Map4dContext);
|
|
347
391
|
var theMap = map || map4dContext.map;
|
|
348
392
|
var dataLayerRef = useRef();
|
|
393
|
+
|
|
349
394
|
var reCreate = function reCreate() {
|
|
350
395
|
var _dataLayerRef$current, _theMap$data2;
|
|
396
|
+
|
|
351
397
|
(_dataLayerRef$current = dataLayerRef.current) === null || _dataLayerRef$current === void 0 ? void 0 : _dataLayerRef$current.forEach(function (feature) {
|
|
352
398
|
var _theMap$data;
|
|
399
|
+
|
|
353
400
|
theMap === null || theMap === void 0 ? void 0 : (_theMap$data = theMap.data) === null || _theMap$data === void 0 ? void 0 : _theMap$data.remove(feature);
|
|
354
401
|
});
|
|
355
402
|
dataLayerRef.current = theMap === null || theMap === void 0 ? void 0 : (_theMap$data2 = theMap.data) === null || _theMap$data2 === void 0 ? void 0 : _theMap$data2.addGeoJson(geoJsonString);
|
|
356
403
|
onCreated && onCreated(dataLayerRef.current);
|
|
357
404
|
};
|
|
405
|
+
|
|
358
406
|
useEffect(function () {
|
|
359
407
|
if (theMap) {
|
|
360
408
|
reCreate();
|
|
@@ -363,8 +411,10 @@ var MFDataLayer = function MFDataLayer(props) {
|
|
|
363
411
|
useEffect(function () {
|
|
364
412
|
return function () {
|
|
365
413
|
var _dataLayerRef$current2;
|
|
414
|
+
|
|
366
415
|
(_dataLayerRef$current2 = dataLayerRef.current) === null || _dataLayerRef$current2 === void 0 ? void 0 : _dataLayerRef$current2.forEach(function (feature) {
|
|
367
416
|
var _theMap$data3;
|
|
417
|
+
|
|
368
418
|
theMap === null || theMap === void 0 ? void 0 : (_theMap$data3 = theMap.data) === null || _theMap$data3 === void 0 ? void 0 : _theMap$data3.remove(feature);
|
|
369
419
|
});
|
|
370
420
|
};
|
|
@@ -374,33 +424,34 @@ var MFDataLayer = function MFDataLayer(props) {
|
|
|
374
424
|
|
|
375
425
|
var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
|
|
376
426
|
var routes = props.routes,
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
427
|
+
activedIndex = props.activedIndex,
|
|
428
|
+
activeStrokeWidth = props.activeStrokeWidth,
|
|
429
|
+
activeStrokeColor = props.activeStrokeColor,
|
|
430
|
+
activeOutlineWidth = props.activeOutlineWidth,
|
|
431
|
+
activeOutlineColor = props.activeOutlineColor,
|
|
432
|
+
activeStrokePattern = props.activeStrokePattern,
|
|
433
|
+
inactiveStrokeWidth = props.inactiveStrokeWidth,
|
|
434
|
+
inactiveStrokeColor = props.inactiveStrokeColor,
|
|
435
|
+
inactiveOutlineWidth = props.inactiveOutlineWidth,
|
|
436
|
+
inactiveOutlineColor = props.inactiveOutlineColor,
|
|
437
|
+
inactiveStrokePattern = props.inactiveStrokePattern,
|
|
438
|
+
originMarkerOptions = props.originMarkerOptions,
|
|
439
|
+
destinationMarkerOptions = props.destinationMarkerOptions,
|
|
440
|
+
waypointMarkerOptions = props.waypointMarkerOptions,
|
|
441
|
+
onMarkerDragEnd = props.onMarkerDragEnd,
|
|
442
|
+
map = props.map,
|
|
443
|
+
onHover = props.onHover,
|
|
444
|
+
onCreated = props.onCreated,
|
|
445
|
+
onMouseOut = props.onMouseOut,
|
|
446
|
+
onMouseOver = props.onMouseOver,
|
|
447
|
+
onMouseMove = props.onMouseMove;
|
|
398
448
|
var map4dContext = useContext(Map4dContext);
|
|
399
449
|
var theMap = map || map4dContext.map;
|
|
400
450
|
var directionRef = useRef();
|
|
401
451
|
useEffect(function () {
|
|
402
452
|
if (theMap && !directionRef.current) {
|
|
403
453
|
var _directionRef$current;
|
|
454
|
+
|
|
404
455
|
var option = {
|
|
405
456
|
routes: routes,
|
|
406
457
|
activedIndex: activedIndex,
|
|
@@ -432,8 +483,10 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
|
|
|
432
483
|
directionRef.current.onMouseMove = onMouseMove;
|
|
433
484
|
onCreated && onCreated(directionRef.current);
|
|
434
485
|
}
|
|
486
|
+
|
|
435
487
|
return function () {
|
|
436
488
|
var _directionRef$current2;
|
|
489
|
+
|
|
437
490
|
(_directionRef$current2 = directionRef.current) === null || _directionRef$current2 === void 0 ? void 0 : _directionRef$current2.setMap(null);
|
|
438
491
|
};
|
|
439
492
|
}, [theMap]);
|
|
@@ -460,37 +513,46 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
|
|
|
460
513
|
useEffect(function () {
|
|
461
514
|
if (theMap) {
|
|
462
515
|
var _directionRef$current3;
|
|
516
|
+
|
|
463
517
|
(_directionRef$current3 = directionRef.current) === null || _directionRef$current3 === void 0 ? void 0 : _directionRef$current3.setMap(theMap);
|
|
464
518
|
}
|
|
519
|
+
|
|
465
520
|
return function () {
|
|
466
521
|
var _directionRef$current4;
|
|
522
|
+
|
|
467
523
|
(_directionRef$current4 = directionRef.current) === null || _directionRef$current4 === void 0 ? void 0 : _directionRef$current4.setMap(null);
|
|
468
524
|
};
|
|
469
525
|
}, [theMap]);
|
|
470
526
|
useEffect(function () {
|
|
471
527
|
return function () {
|
|
472
528
|
var _directionRef$current5;
|
|
529
|
+
|
|
473
530
|
(_directionRef$current5 = directionRef.current) === null || _directionRef$current5 === void 0 ? void 0 : _directionRef$current5.setMap(null);
|
|
474
531
|
};
|
|
475
532
|
}, []);
|
|
476
533
|
useEffect(function () {
|
|
477
534
|
var _directionRef$current6;
|
|
535
|
+
|
|
478
536
|
routes != undefined && ((_directionRef$current6 = directionRef.current) === null || _directionRef$current6 === void 0 ? void 0 : _directionRef$current6.setRoutes(routes));
|
|
479
537
|
}, [routes]);
|
|
480
538
|
useEffect(function () {
|
|
481
539
|
var _directionRef$current7;
|
|
540
|
+
|
|
482
541
|
activedIndex != undefined && ((_directionRef$current7 = directionRef.current) === null || _directionRef$current7 === void 0 ? void 0 : _directionRef$current7.setActivedIndex(activedIndex));
|
|
483
542
|
}, [activedIndex]);
|
|
484
543
|
useEffect(function () {
|
|
485
544
|
var _directionRef$current8;
|
|
545
|
+
|
|
486
546
|
activeStrokePattern != undefined && ((_directionRef$current8 = directionRef.current) === null || _directionRef$current8 === void 0 ? void 0 : _directionRef$current8.setActiveStrokePattern(activeStrokePattern));
|
|
487
547
|
}, [activeStrokePattern]);
|
|
488
548
|
useEffect(function () {
|
|
489
549
|
var _directionRef$current9;
|
|
550
|
+
|
|
490
551
|
inactiveStrokePattern != undefined && ((_directionRef$current9 = directionRef.current) === null || _directionRef$current9 === void 0 ? void 0 : _directionRef$current9.setInactiveStrokePattern(inactiveStrokePattern));
|
|
491
552
|
}, [inactiveStrokePattern]);
|
|
492
553
|
useEffect(function () {
|
|
493
554
|
var _directionRef$current10;
|
|
555
|
+
|
|
494
556
|
var option = {
|
|
495
557
|
routes: routes,
|
|
496
558
|
activedIndex: activedIndex,
|
|
@@ -521,18 +583,20 @@ var MFDirectionsRenderer = function MFDirectionsRenderer(props) {
|
|
|
521
583
|
|
|
522
584
|
var MFGroundOverlay = function MFGroundOverlay(props) {
|
|
523
585
|
var bounds = props.bounds,
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
586
|
+
getUrl = props.getUrl,
|
|
587
|
+
override = props.override,
|
|
588
|
+
visible = props.visible,
|
|
589
|
+
zIndex = props.zIndex,
|
|
590
|
+
opacity = props.opacity,
|
|
591
|
+
map = props.map,
|
|
592
|
+
onCreated = props.onCreated;
|
|
531
593
|
var map4dContext = useContext(Map4dContext);
|
|
532
594
|
var theMap = map || map4dContext.map;
|
|
533
595
|
var groundOverlayRef = useRef();
|
|
596
|
+
|
|
534
597
|
var reCreate = function reCreate() {
|
|
535
598
|
var _groundOverlayRef$cur, _groundOverlayRef$cur2;
|
|
599
|
+
|
|
536
600
|
(_groundOverlayRef$cur = groundOverlayRef.current) === null || _groundOverlayRef$cur === void 0 ? void 0 : _groundOverlayRef$cur.setMap(null);
|
|
537
601
|
var option = {
|
|
538
602
|
bounds: bounds,
|
|
@@ -551,6 +615,7 @@ var MFGroundOverlay = function MFGroundOverlay(props) {
|
|
|
551
615
|
(_groundOverlayRef$cur2 = groundOverlayRef.current) === null || _groundOverlayRef$cur2 === void 0 ? void 0 : _groundOverlayRef$cur2.setMap(theMap);
|
|
552
616
|
onCreated && onCreated(groundOverlayRef.current);
|
|
553
617
|
};
|
|
618
|
+
|
|
554
619
|
useEffect(function () {
|
|
555
620
|
if (theMap && !groundOverlayRef.current) {
|
|
556
621
|
reCreate();
|
|
@@ -559,16 +624,20 @@ var MFGroundOverlay = function MFGroundOverlay(props) {
|
|
|
559
624
|
useEffect(function () {
|
|
560
625
|
if (theMap) {
|
|
561
626
|
var _groundOverlayRef$cur3;
|
|
627
|
+
|
|
562
628
|
(_groundOverlayRef$cur3 = groundOverlayRef.current) === null || _groundOverlayRef$cur3 === void 0 ? void 0 : _groundOverlayRef$cur3.setMap(theMap);
|
|
563
629
|
}
|
|
630
|
+
|
|
564
631
|
return function () {
|
|
565
632
|
var _groundOverlayRef$cur4;
|
|
633
|
+
|
|
566
634
|
(_groundOverlayRef$cur4 = groundOverlayRef.current) === null || _groundOverlayRef$cur4 === void 0 ? void 0 : _groundOverlayRef$cur4.setMap(null);
|
|
567
635
|
};
|
|
568
636
|
}, [theMap]);
|
|
569
637
|
useEffect(function () {
|
|
570
638
|
return function () {
|
|
571
639
|
var _groundOverlayRef$cur5;
|
|
640
|
+
|
|
572
641
|
(_groundOverlayRef$cur5 = groundOverlayRef.current) === null || _groundOverlayRef$cur5 === void 0 ? void 0 : _groundOverlayRef$cur5.setMap(null);
|
|
573
642
|
};
|
|
574
643
|
}, []);
|
|
@@ -579,14 +648,17 @@ var MFGroundOverlay = function MFGroundOverlay(props) {
|
|
|
579
648
|
}, [bounds, getUrl, override]);
|
|
580
649
|
useEffect(function () {
|
|
581
650
|
var _groundOverlayRef$cur6;
|
|
651
|
+
|
|
582
652
|
visible != undefined && ((_groundOverlayRef$cur6 = groundOverlayRef.current) === null || _groundOverlayRef$cur6 === void 0 ? void 0 : _groundOverlayRef$cur6.setVisible(visible));
|
|
583
653
|
}, [visible]);
|
|
584
654
|
useEffect(function () {
|
|
585
655
|
var _groundOverlayRef$cur7;
|
|
656
|
+
|
|
586
657
|
zIndex != undefined && ((_groundOverlayRef$cur7 = groundOverlayRef.current) === null || _groundOverlayRef$cur7 === void 0 ? void 0 : _groundOverlayRef$cur7.setZIndex(zIndex));
|
|
587
658
|
}, [zIndex]);
|
|
588
659
|
useEffect(function () {
|
|
589
660
|
var _groundOverlayRef$cur8;
|
|
661
|
+
|
|
590
662
|
opacity != undefined && ((_groundOverlayRef$cur8 = groundOverlayRef.current) === null || _groundOverlayRef$cur8 === void 0 ? void 0 : _groundOverlayRef$cur8.setOpacity(opacity));
|
|
591
663
|
}, [opacity]);
|
|
592
664
|
return null;
|
|
@@ -594,17 +666,19 @@ var MFGroundOverlay = function MFGroundOverlay(props) {
|
|
|
594
666
|
|
|
595
667
|
var MFImageOverlay = function MFImageOverlay(props) {
|
|
596
668
|
var url = props.url,
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
669
|
+
bounds = props.bounds,
|
|
670
|
+
visible = props.visible,
|
|
671
|
+
zIndex = props.zIndex,
|
|
672
|
+
opacity = props.opacity,
|
|
673
|
+
map = props.map,
|
|
674
|
+
onCreated = props.onCreated;
|
|
603
675
|
var map4dContext = useContext(Map4dContext);
|
|
604
676
|
var theMap = map || map4dContext.map;
|
|
605
677
|
var imageOverlayRef = useRef();
|
|
678
|
+
|
|
606
679
|
var reCreate = function reCreate() {
|
|
607
680
|
var _imageOverlayRef$curr, _imageOverlayRef$curr2;
|
|
681
|
+
|
|
608
682
|
(_imageOverlayRef$curr = imageOverlayRef.current) === null || _imageOverlayRef$curr === void 0 ? void 0 : _imageOverlayRef$curr.setMap(null);
|
|
609
683
|
var option = {
|
|
610
684
|
url: url,
|
|
@@ -622,6 +696,7 @@ var MFImageOverlay = function MFImageOverlay(props) {
|
|
|
622
696
|
(_imageOverlayRef$curr2 = imageOverlayRef.current) === null || _imageOverlayRef$curr2 === void 0 ? void 0 : _imageOverlayRef$curr2.setMap(theMap);
|
|
623
697
|
onCreated && onCreated(imageOverlayRef.current);
|
|
624
698
|
};
|
|
699
|
+
|
|
625
700
|
useEffect(function () {
|
|
626
701
|
if (theMap && !imageOverlayRef.current) {
|
|
627
702
|
reCreate();
|
|
@@ -630,16 +705,20 @@ var MFImageOverlay = function MFImageOverlay(props) {
|
|
|
630
705
|
useEffect(function () {
|
|
631
706
|
if (theMap) {
|
|
632
707
|
var _imageOverlayRef$curr3;
|
|
708
|
+
|
|
633
709
|
(_imageOverlayRef$curr3 = imageOverlayRef.current) === null || _imageOverlayRef$curr3 === void 0 ? void 0 : _imageOverlayRef$curr3.setMap(theMap);
|
|
634
710
|
}
|
|
711
|
+
|
|
635
712
|
return function () {
|
|
636
713
|
var _imageOverlayRef$curr4;
|
|
714
|
+
|
|
637
715
|
(_imageOverlayRef$curr4 = imageOverlayRef.current) === null || _imageOverlayRef$curr4 === void 0 ? void 0 : _imageOverlayRef$curr4.setMap(null);
|
|
638
716
|
};
|
|
639
717
|
}, [theMap]);
|
|
640
718
|
useEffect(function () {
|
|
641
719
|
return function () {
|
|
642
720
|
var _imageOverlayRef$curr5;
|
|
721
|
+
|
|
643
722
|
(_imageOverlayRef$curr5 = imageOverlayRef.current) === null || _imageOverlayRef$curr5 === void 0 ? void 0 : _imageOverlayRef$curr5.setMap(null);
|
|
644
723
|
};
|
|
645
724
|
}, []);
|
|
@@ -650,10 +729,12 @@ var MFImageOverlay = function MFImageOverlay(props) {
|
|
|
650
729
|
}, [url, bounds, zIndex]);
|
|
651
730
|
useEffect(function () {
|
|
652
731
|
var _imageOverlayRef$curr6;
|
|
732
|
+
|
|
653
733
|
visible != undefined && ((_imageOverlayRef$curr6 = imageOverlayRef.current) === null || _imageOverlayRef$curr6 === void 0 ? void 0 : _imageOverlayRef$curr6.setVisible(visible));
|
|
654
734
|
}, [visible]);
|
|
655
735
|
useEffect(function () {
|
|
656
736
|
var _imageOverlayRef$curr7;
|
|
737
|
+
|
|
657
738
|
opacity != undefined && ((_imageOverlayRef$curr7 = imageOverlayRef.current) === null || _imageOverlayRef$curr7 === void 0 ? void 0 : _imageOverlayRef$curr7.setOpacity(opacity));
|
|
658
739
|
}, [opacity]);
|
|
659
740
|
return null;
|
|
@@ -662,9 +743,11 @@ var MFImageOverlay = function MFImageOverlay(props) {
|
|
|
662
743
|
function addLibrary(url, id) {
|
|
663
744
|
var scriptId = "script_" + id;
|
|
664
745
|
var exist = document.getElementById(scriptId);
|
|
746
|
+
|
|
665
747
|
if (exist) {
|
|
666
748
|
return null;
|
|
667
749
|
}
|
|
750
|
+
|
|
668
751
|
var script = document.createElement('script');
|
|
669
752
|
script.src = url;
|
|
670
753
|
script.defer = true;
|
|
@@ -672,6 +755,7 @@ function addLibrary(url, id) {
|
|
|
672
755
|
document.body.appendChild(script);
|
|
673
756
|
return script;
|
|
674
757
|
}
|
|
758
|
+
|
|
675
759
|
var createId = function createId() {
|
|
676
760
|
var dt = new Date().getTime();
|
|
677
761
|
var uuid = 'xxxxxxxx_xxxx_4xxx_yxxx_xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
@@ -681,194 +765,239 @@ var createId = function createId() {
|
|
|
681
765
|
});
|
|
682
766
|
return uuid;
|
|
683
767
|
};
|
|
768
|
+
|
|
684
769
|
var MFMap = function MFMap(props) {
|
|
685
770
|
var _props$options3, _props$options8;
|
|
771
|
+
|
|
686
772
|
var callback = useRef("callback");
|
|
687
773
|
var mapDomRef = useRef();
|
|
688
774
|
var mapRef = useRef();
|
|
689
775
|
var scriptElement = useRef();
|
|
690
776
|
var url = useRef();
|
|
691
777
|
var events = useRef([]);
|
|
778
|
+
|
|
692
779
|
var _useState = useState(),
|
|
693
|
-
|
|
694
|
-
|
|
780
|
+
map = _useState[0],
|
|
781
|
+
setMap = _useState[1];
|
|
782
|
+
|
|
695
783
|
useEffect(function () {
|
|
696
784
|
var id = createId();
|
|
697
785
|
callback.current = "callback_" + id;
|
|
786
|
+
|
|
698
787
|
var createCallback = function createCallback() {
|
|
699
788
|
window[callback.current] = function () {
|
|
700
789
|
var options = props.options;
|
|
701
790
|
mapRef.current = new window.map4d.Map(mapDomRef.current, options);
|
|
791
|
+
|
|
702
792
|
if (props.onMapReady) {
|
|
703
793
|
props.onMapReady(mapRef.current, id);
|
|
704
794
|
}
|
|
795
|
+
|
|
705
796
|
registerEvent();
|
|
706
797
|
setMap(mapRef.current);
|
|
707
798
|
};
|
|
708
799
|
};
|
|
800
|
+
|
|
709
801
|
var domain = "https://api" + (props.environment ? "-" + props.environment : "") + ".map4d.vn";
|
|
802
|
+
|
|
710
803
|
if (props.sdkDomain) {
|
|
711
804
|
domain = props.sdkDomain;
|
|
712
805
|
}
|
|
806
|
+
|
|
713
807
|
var urlNew = domain + "/sdk/map/js?version=" + props.version + "&key=" + props.accessKey + "&callback=" + callback.current;
|
|
808
|
+
|
|
714
809
|
if (props.mapid) {
|
|
715
810
|
urlNew += "&mapId=" + props.mapid;
|
|
716
811
|
}
|
|
812
|
+
|
|
717
813
|
createCallback();
|
|
718
814
|
var script = addLibrary(urlNew, id);
|
|
815
|
+
|
|
719
816
|
if (script) {
|
|
720
817
|
scriptElement.current = script;
|
|
721
818
|
}
|
|
819
|
+
|
|
722
820
|
url.current = urlNew;
|
|
723
821
|
return function () {
|
|
724
822
|
var destroy = function destroy() {
|
|
725
823
|
var _events$current, _mapRef$current;
|
|
824
|
+
|
|
726
825
|
delete window[callback.current];
|
|
826
|
+
|
|
727
827
|
if (scriptElement.current != null) {
|
|
728
828
|
scriptElement.current.remove();
|
|
729
829
|
}
|
|
830
|
+
|
|
730
831
|
(_events$current = events.current) === null || _events$current === void 0 ? void 0 : _events$current.forEach(function (t) {
|
|
731
832
|
t === null || t === void 0 ? void 0 : t.remove();
|
|
732
833
|
});
|
|
733
834
|
(_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.destroy();
|
|
734
835
|
url.current = undefined;
|
|
735
836
|
};
|
|
837
|
+
|
|
736
838
|
destroy();
|
|
737
839
|
};
|
|
738
840
|
}, [props.environment, props.version, props.accessKey]);
|
|
739
841
|
useEffect(function () {
|
|
740
842
|
var _props$options, _mapRef$current2, _props$options2;
|
|
843
|
+
|
|
741
844
|
((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.mapType) != undefined && ((_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.setMapType((_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _props$options2.mapType));
|
|
742
845
|
}, [(_props$options3 = props.options) === null || _props$options3 === void 0 ? void 0 : _props$options3.mapType]);
|
|
743
846
|
useEffect(function () {
|
|
744
847
|
var _props$options4, _props$options6, _mapRef$current5, _props$options7;
|
|
848
|
+
|
|
745
849
|
if (((_props$options4 = props.options) === null || _props$options4 === void 0 ? void 0 : _props$options4.center) != undefined) {
|
|
746
850
|
var _mapRef$current3, _props$options5, _mapRef$current4;
|
|
851
|
+
|
|
747
852
|
var camera = (_mapRef$current3 = mapRef.current) === null || _mapRef$current3 === void 0 ? void 0 : _mapRef$current3.getCamera();
|
|
748
853
|
camera === null || camera === void 0 ? void 0 : camera.setTarget((_props$options5 = props.options) === null || _props$options5 === void 0 ? void 0 : _props$options5.center);
|
|
749
854
|
(_mapRef$current4 = mapRef.current) === null || _mapRef$current4 === void 0 ? void 0 : _mapRef$current4.moveCamera(camera);
|
|
750
855
|
}
|
|
856
|
+
|
|
751
857
|
((_props$options6 = props.options) === null || _props$options6 === void 0 ? void 0 : _props$options6.mapType) != undefined && ((_mapRef$current5 = mapRef.current) === null || _mapRef$current5 === void 0 ? void 0 : _mapRef$current5.setMapType((_props$options7 = props.options) === null || _props$options7 === void 0 ? void 0 : _props$options7.mapType));
|
|
752
858
|
}, [(_props$options8 = props.options) === null || _props$options8 === void 0 ? void 0 : _props$options8.center]);
|
|
859
|
+
|
|
753
860
|
var registerEvent = function registerEvent() {
|
|
754
861
|
var _mapRef$current6, _mapRef$current7, _mapRef$current8, _mapRef$current9, _mapRef$current10, _mapRef$current11, _mapRef$current12, _mapRef$current13, _mapRef$current14, _mapRef$current15, _mapRef$current16, _mapRef$current17, _mapRef$current18, _mapRef$current19, _mapRef$current20, _mapRef$current21, _mapRef$current22, _mapRef$current23, _mapRef$current24;
|
|
862
|
+
|
|
755
863
|
var eventClickMarker = (_mapRef$current6 = mapRef.current) === null || _mapRef$current6 === void 0 ? void 0 : _mapRef$current6.addListener("click", function (args) {
|
|
756
864
|
var _args$marker, _args$marker2;
|
|
865
|
+
|
|
757
866
|
((_args$marker = args.marker) === null || _args$marker === void 0 ? void 0 : _args$marker.onClick) && ((_args$marker2 = args.marker) === null || _args$marker2 === void 0 ? void 0 : _args$marker2.onClick(args));
|
|
758
867
|
}, {
|
|
759
868
|
marker: true
|
|
760
869
|
});
|
|
761
870
|
var eventRightClickMarker = (_mapRef$current7 = mapRef.current) === null || _mapRef$current7 === void 0 ? void 0 : _mapRef$current7.addListener("rightClick", function (args) {
|
|
762
871
|
var _args$marker3, _args$marker4;
|
|
872
|
+
|
|
763
873
|
((_args$marker3 = args.marker) === null || _args$marker3 === void 0 ? void 0 : _args$marker3.onRightClick) && ((_args$marker4 = args.marker) === null || _args$marker4 === void 0 ? void 0 : _args$marker4.onRightClick(args));
|
|
764
874
|
}, {
|
|
765
875
|
marker: true
|
|
766
876
|
});
|
|
767
877
|
var eventDragEndMarker = (_mapRef$current8 = mapRef.current) === null || _mapRef$current8 === void 0 ? void 0 : _mapRef$current8.addListener("dragEnd", function (args) {
|
|
768
878
|
var _args$marker5, _args$marker6;
|
|
879
|
+
|
|
769
880
|
((_args$marker5 = args.marker) === null || _args$marker5 === void 0 ? void 0 : _args$marker5.onDragEnd) && ((_args$marker6 = args.marker) === null || _args$marker6 === void 0 ? void 0 : _args$marker6.onDragEnd(args));
|
|
770
881
|
}, {
|
|
771
882
|
marker: true
|
|
772
883
|
});
|
|
773
884
|
var eventHoverMarker = (_mapRef$current9 = mapRef.current) === null || _mapRef$current9 === void 0 ? void 0 : _mapRef$current9.addListener("hover", function (args) {
|
|
774
885
|
var _args$marker7, _args$marker8;
|
|
886
|
+
|
|
775
887
|
((_args$marker7 = args.marker) === null || _args$marker7 === void 0 ? void 0 : _args$marker7.onHover) && ((_args$marker8 = args.marker) === null || _args$marker8 === void 0 ? void 0 : _args$marker8.onHover(args));
|
|
776
888
|
}, {
|
|
777
889
|
marker: true
|
|
778
890
|
});
|
|
779
891
|
var eventHoverPolygon = (_mapRef$current10 = mapRef.current) === null || _mapRef$current10 === void 0 ? void 0 : _mapRef$current10.addListener("hover", function (args) {
|
|
780
892
|
var _args$polygon, _args$polygon2;
|
|
893
|
+
|
|
781
894
|
((_args$polygon = args.polygon) === null || _args$polygon === void 0 ? void 0 : _args$polygon.onHover) && ((_args$polygon2 = args.polygon) === null || _args$polygon2 === void 0 ? void 0 : _args$polygon2.onHover(args));
|
|
782
895
|
}, {
|
|
783
896
|
polygon: true
|
|
784
897
|
});
|
|
785
898
|
var eventHoverPolyline = (_mapRef$current11 = mapRef.current) === null || _mapRef$current11 === void 0 ? void 0 : _mapRef$current11.addListener("hover", function (args) {
|
|
786
899
|
var _args$polyline, _args$polyline2;
|
|
900
|
+
|
|
787
901
|
((_args$polyline = args.polyline) === null || _args$polyline === void 0 ? void 0 : _args$polyline.onHover) && ((_args$polyline2 = args.polyline) === null || _args$polyline2 === void 0 ? void 0 : _args$polyline2.onHover(args));
|
|
788
902
|
}, {
|
|
789
903
|
polyline: true
|
|
790
904
|
});
|
|
791
905
|
var eventHoverDirection = (_mapRef$current12 = mapRef.current) === null || _mapRef$current12 === void 0 ? void 0 : _mapRef$current12.addListener("hover", function (args) {
|
|
792
906
|
var _args$renderer, _args$renderer2;
|
|
907
|
+
|
|
793
908
|
((_args$renderer = args.renderer) === null || _args$renderer === void 0 ? void 0 : _args$renderer.onHover) && ((_args$renderer2 = args.renderer) === null || _args$renderer2 === void 0 ? void 0 : _args$renderer2.onHover(args));
|
|
794
909
|
}, {
|
|
795
910
|
directions: true
|
|
796
911
|
});
|
|
797
912
|
var eventClickPolyline = (_mapRef$current13 = mapRef.current) === null || _mapRef$current13 === void 0 ? void 0 : _mapRef$current13.addListener("click", function (args) {
|
|
798
913
|
var _args$polyline3, _args$polyline4;
|
|
914
|
+
|
|
799
915
|
((_args$polyline3 = args.polyline) === null || _args$polyline3 === void 0 ? void 0 : _args$polyline3.onClick) && ((_args$polyline4 = args.polyline) === null || _args$polyline4 === void 0 ? void 0 : _args$polyline4.onClick(args));
|
|
800
916
|
}, {
|
|
801
917
|
polyline: true
|
|
802
918
|
});
|
|
803
919
|
var eventMouseOutDirection = (_mapRef$current14 = mapRef.current) === null || _mapRef$current14 === void 0 ? void 0 : _mapRef$current14.addListener("mouseOut", function (args) {
|
|
804
920
|
var _args$renderer3, _args$renderer4;
|
|
921
|
+
|
|
805
922
|
((_args$renderer3 = args.renderer) === null || _args$renderer3 === void 0 ? void 0 : _args$renderer3.onMouseOut) && ((_args$renderer4 = args.renderer) === null || _args$renderer4 === void 0 ? void 0 : _args$renderer4.onMouseOut(args));
|
|
806
923
|
}, {
|
|
807
924
|
directions: true
|
|
808
925
|
});
|
|
809
926
|
var eventMouseOverDirection = (_mapRef$current15 = mapRef.current) === null || _mapRef$current15 === void 0 ? void 0 : _mapRef$current15.addListener("mouseOver", function (args) {
|
|
810
927
|
var _args$renderer5, _args$renderer6;
|
|
928
|
+
|
|
811
929
|
((_args$renderer5 = args.renderer) === null || _args$renderer5 === void 0 ? void 0 : _args$renderer5.onMouseOver) && ((_args$renderer6 = args.renderer) === null || _args$renderer6 === void 0 ? void 0 : _args$renderer6.onMouseOver(args));
|
|
812
930
|
}, {
|
|
813
931
|
directions: true
|
|
814
932
|
});
|
|
815
933
|
var eventMouseMoveDirection = (_mapRef$current16 = mapRef.current) === null || _mapRef$current16 === void 0 ? void 0 : _mapRef$current16.addListener("mouseMove", function (args) {
|
|
816
934
|
var _args$renderer7, _args$renderer8;
|
|
935
|
+
|
|
817
936
|
((_args$renderer7 = args.renderer) === null || _args$renderer7 === void 0 ? void 0 : _args$renderer7.onMouseMove) && ((_args$renderer8 = args.renderer) === null || _args$renderer8 === void 0 ? void 0 : _args$renderer8.onMouseMove(args));
|
|
818
937
|
}, {
|
|
819
938
|
directions: true
|
|
820
939
|
});
|
|
821
940
|
var eventMouseOutPolyline = (_mapRef$current17 = mapRef.current) === null || _mapRef$current17 === void 0 ? void 0 : _mapRef$current17.addListener("mouseOut", function (args) {
|
|
822
941
|
var _args$polyline5, _args$polyline6;
|
|
942
|
+
|
|
823
943
|
((_args$polyline5 = args.polyline) === null || _args$polyline5 === void 0 ? void 0 : _args$polyline5.onMouseOut) && ((_args$polyline6 = args.polyline) === null || _args$polyline6 === void 0 ? void 0 : _args$polyline6.onMouseOut(args));
|
|
824
944
|
}, {
|
|
825
945
|
polyline: true
|
|
826
946
|
});
|
|
827
947
|
var eventMouseOverPolyline = (_mapRef$current18 = mapRef.current) === null || _mapRef$current18 === void 0 ? void 0 : _mapRef$current18.addListener("mouseOver", function (args) {
|
|
828
948
|
var _args$polyline7, _args$polyline8;
|
|
949
|
+
|
|
829
950
|
((_args$polyline7 = args.polyline) === null || _args$polyline7 === void 0 ? void 0 : _args$polyline7.onMouseOver) && ((_args$polyline8 = args.polyline) === null || _args$polyline8 === void 0 ? void 0 : _args$polyline8.onMouseOver(args));
|
|
830
951
|
}, {
|
|
831
952
|
polyline: true
|
|
832
953
|
});
|
|
833
954
|
var eventMouseMovePolyline = (_mapRef$current19 = mapRef.current) === null || _mapRef$current19 === void 0 ? void 0 : _mapRef$current19.addListener("mouseMove", function (args) {
|
|
834
955
|
var _args$polyline9, _args$polyline10;
|
|
956
|
+
|
|
835
957
|
((_args$polyline9 = args.polyline) === null || _args$polyline9 === void 0 ? void 0 : _args$polyline9.onMouseMove) && ((_args$polyline10 = args.polyline) === null || _args$polyline10 === void 0 ? void 0 : _args$polyline10.onMouseMove(args));
|
|
836
958
|
}, {
|
|
837
959
|
polyline: true
|
|
838
960
|
});
|
|
839
961
|
var eventMouseOutMarker = (_mapRef$current20 = mapRef.current) === null || _mapRef$current20 === void 0 ? void 0 : _mapRef$current20.addListener("mouseOut", function (args) {
|
|
840
962
|
var _args$marker9, _args$marker10;
|
|
963
|
+
|
|
841
964
|
((_args$marker9 = args.marker) === null || _args$marker9 === void 0 ? void 0 : _args$marker9.onMouseOut) && ((_args$marker10 = args.marker) === null || _args$marker10 === void 0 ? void 0 : _args$marker10.onMouseOut(args));
|
|
842
965
|
}, {
|
|
843
966
|
marker: true
|
|
844
967
|
});
|
|
845
968
|
var eventMouseOverMarker = (_mapRef$current21 = mapRef.current) === null || _mapRef$current21 === void 0 ? void 0 : _mapRef$current21.addListener("mouseOver", function (args) {
|
|
846
969
|
var _args$marker11, _args$marker12;
|
|
970
|
+
|
|
847
971
|
((_args$marker11 = args.marker) === null || _args$marker11 === void 0 ? void 0 : _args$marker11.onMouseOver) && ((_args$marker12 = args.marker) === null || _args$marker12 === void 0 ? void 0 : _args$marker12.onMouseOver(args));
|
|
848
972
|
}, {
|
|
849
973
|
marker: true
|
|
850
974
|
});
|
|
851
975
|
var eventMouseMoveMarker = (_mapRef$current22 = mapRef.current) === null || _mapRef$current22 === void 0 ? void 0 : _mapRef$current22.addListener("mouseMove", function (args) {
|
|
852
976
|
var _args$marker13, _args$marker14;
|
|
977
|
+
|
|
853
978
|
((_args$marker13 = args.marker) === null || _args$marker13 === void 0 ? void 0 : _args$marker13.onMouseMove) && ((_args$marker14 = args.marker) === null || _args$marker14 === void 0 ? void 0 : _args$marker14.onMouseMove(args));
|
|
854
979
|
}, {
|
|
855
980
|
marker: true
|
|
856
981
|
});
|
|
857
982
|
var eventClickPoi = (_mapRef$current23 = mapRef.current) === null || _mapRef$current23 === void 0 ? void 0 : _mapRef$current23.addListener("click", function (args) {
|
|
858
983
|
var _args$poi, _args$poi2;
|
|
984
|
+
|
|
859
985
|
((_args$poi = args.poi) === null || _args$poi === void 0 ? void 0 : _args$poi.onClick) && ((_args$poi2 = args.poi) === null || _args$poi2 === void 0 ? void 0 : _args$poi2.onClick(args));
|
|
860
986
|
}, {
|
|
861
987
|
poi: true
|
|
862
988
|
});
|
|
863
989
|
var eventHoverPoi = (_mapRef$current24 = mapRef.current) === null || _mapRef$current24 === void 0 ? void 0 : _mapRef$current24.addListener("hover", function (args) {
|
|
864
990
|
var _args$poi3, _args$poi4;
|
|
991
|
+
|
|
865
992
|
((_args$poi3 = args.poi) === null || _args$poi3 === void 0 ? void 0 : _args$poi3.onHover) && ((_args$poi4 = args.poi) === null || _args$poi4 === void 0 ? void 0 : _args$poi4.onHover(args));
|
|
866
993
|
}, {
|
|
867
994
|
poi: true
|
|
868
995
|
});
|
|
869
996
|
events.current = events.current.concat([eventClickMarker, eventRightClickMarker, eventDragEndMarker, eventHoverMarker, eventHoverPolygon, eventHoverPolyline, eventHoverDirection, eventClickPolyline, eventMouseOutDirection, eventMouseOverDirection, eventMouseMoveDirection, eventMouseOutPolyline, eventMouseOverPolyline, eventMouseMovePolyline, eventMouseOutMarker, eventMouseOverMarker, eventMouseMoveMarker, eventClickPoi, eventHoverPoi]);
|
|
997
|
+
|
|
870
998
|
if (props.onClickLocation) {
|
|
871
999
|
var _mapRef$current25;
|
|
1000
|
+
|
|
872
1001
|
var onClickLocation = (_mapRef$current25 = mapRef.current) === null || _mapRef$current25 === void 0 ? void 0 : _mapRef$current25.addListener("click", function (args) {
|
|
873
1002
|
props.onClickLocation && props.onClickLocation(args);
|
|
874
1003
|
}, {
|
|
@@ -876,8 +1005,10 @@ var MFMap = function MFMap(props) {
|
|
|
876
1005
|
});
|
|
877
1006
|
events.current.push(onClickLocation);
|
|
878
1007
|
}
|
|
1008
|
+
|
|
879
1009
|
if (props.onRightClickLocation) {
|
|
880
1010
|
var _mapRef$current26;
|
|
1011
|
+
|
|
881
1012
|
var onRightClickLocation = (_mapRef$current26 = mapRef.current) === null || _mapRef$current26 === void 0 ? void 0 : _mapRef$current26.addListener("rightClick", function (args) {
|
|
882
1013
|
props.onRightClickLocation && props.onRightClickLocation(args);
|
|
883
1014
|
}, {
|
|
@@ -885,8 +1016,10 @@ var MFMap = function MFMap(props) {
|
|
|
885
1016
|
});
|
|
886
1017
|
events.current.push(onRightClickLocation);
|
|
887
1018
|
}
|
|
1019
|
+
|
|
888
1020
|
if (props.onTilesLoaded) {
|
|
889
1021
|
var _mapRef$current27;
|
|
1022
|
+
|
|
890
1023
|
var onTilesLoaded = (_mapRef$current27 = mapRef.current) === null || _mapRef$current27 === void 0 ? void 0 : _mapRef$current27.addListener("tilesLoaded", function (args) {
|
|
891
1024
|
props.onTilesLoaded && props.onTilesLoaded(args);
|
|
892
1025
|
}, {
|
|
@@ -894,8 +1027,10 @@ var MFMap = function MFMap(props) {
|
|
|
894
1027
|
});
|
|
895
1028
|
events.current.push(onTilesLoaded);
|
|
896
1029
|
}
|
|
1030
|
+
|
|
897
1031
|
if (props.onCameraChanging) {
|
|
898
1032
|
var _mapRef$current28;
|
|
1033
|
+
|
|
899
1034
|
var onCameraChanging = (_mapRef$current28 = mapRef.current) === null || _mapRef$current28 === void 0 ? void 0 : _mapRef$current28.addListener("cameraChanging", function (args) {
|
|
900
1035
|
props.onCameraChanging && props.onCameraChanging(args);
|
|
901
1036
|
}, {
|
|
@@ -904,6 +1039,7 @@ var MFMap = function MFMap(props) {
|
|
|
904
1039
|
events.current.push(onCameraChanging);
|
|
905
1040
|
}
|
|
906
1041
|
};
|
|
1042
|
+
|
|
907
1043
|
var newContext = {
|
|
908
1044
|
map: map
|
|
909
1045
|
};
|
|
@@ -921,30 +1057,30 @@ var MFMap = function MFMap(props) {
|
|
|
921
1057
|
|
|
922
1058
|
var MFMarker = function MFMarker(props) {
|
|
923
1059
|
var position = props.position,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1060
|
+
_props$visible = props.visible,
|
|
1061
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
1062
|
+
anchor = props.anchor,
|
|
1063
|
+
labelAnchor = props.labelAnchor,
|
|
1064
|
+
icon = props.icon,
|
|
1065
|
+
elevation = props.elevation,
|
|
1066
|
+
rotation = props.rotation,
|
|
1067
|
+
title = props.title,
|
|
1068
|
+
snippet = props.snippet,
|
|
1069
|
+
windowAnchor = props.windowAnchor,
|
|
1070
|
+
zIndex = props.zIndex,
|
|
1071
|
+
label = props.label,
|
|
1072
|
+
draggable = props.draggable,
|
|
1073
|
+
iconView = props.iconView,
|
|
1074
|
+
clickable = props.clickable,
|
|
1075
|
+
map = props.map,
|
|
1076
|
+
onCreated = props.onCreated,
|
|
1077
|
+
onClick = props.onClick,
|
|
1078
|
+
onRightClick = props.onRightClick,
|
|
1079
|
+
onDragEnd = props.onDragEnd,
|
|
1080
|
+
onHover = props.onHover,
|
|
1081
|
+
onMouseOut = props.onMouseOut,
|
|
1082
|
+
onMouseOver = props.onMouseOver,
|
|
1083
|
+
onMouseMove = props.onMouseMove;
|
|
948
1084
|
var map4dContext = useContext(Map4dContext);
|
|
949
1085
|
var markerClusterContext = useContext(MarkerClusterContext);
|
|
950
1086
|
var theMap = map || map4dContext.map;
|
|
@@ -968,31 +1104,39 @@ var MFMarker = function MFMarker(props) {
|
|
|
968
1104
|
label: label,
|
|
969
1105
|
draggable: draggable,
|
|
970
1106
|
iconView: iconView,
|
|
971
|
-
|
|
1107
|
+
clickable: clickable
|
|
972
1108
|
};
|
|
973
1109
|
Object.keys(option).forEach(function (key) {
|
|
974
1110
|
if (option[key] == undefined || option[key] == null) {
|
|
975
1111
|
delete option[key];
|
|
976
1112
|
}
|
|
977
1113
|
});
|
|
1114
|
+
|
|
978
1115
|
if (icon) {
|
|
979
1116
|
var iconT = new map4d.Icon(icon.width, icon.height, icon.url);
|
|
980
1117
|
option.icon = iconT;
|
|
981
1118
|
}
|
|
1119
|
+
|
|
982
1120
|
markerRef.current = new map4d.Marker(option);
|
|
1121
|
+
|
|
983
1122
|
if (props.infoWindow != undefined) {
|
|
984
1123
|
markerRef.current.setInfoWindow(props.infoWindow);
|
|
985
1124
|
}
|
|
1125
|
+
|
|
986
1126
|
if (props.infoContents != undefined) {
|
|
987
1127
|
markerRef.current.setInfoContents(props.infoContents);
|
|
988
1128
|
}
|
|
1129
|
+
|
|
989
1130
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
990
1131
|
markerRef.current.setMap(theMap);
|
|
991
1132
|
}
|
|
1133
|
+
|
|
992
1134
|
if (props.showInfoWindow != undefined) {
|
|
993
1135
|
var _markerRef$current, _markerRef$current2;
|
|
1136
|
+
|
|
994
1137
|
props.showInfoWindow ? (_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.showInfoWindow() : (_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : _markerRef$current2.hideInfoWindow();
|
|
995
1138
|
}
|
|
1139
|
+
|
|
996
1140
|
markerRef.current.onClick = onClick;
|
|
997
1141
|
markerRef.current.onRightClick = props.onRightClick;
|
|
998
1142
|
markerRef.current.onDragEnd = props.onDragEnd;
|
|
@@ -1008,12 +1152,15 @@ var MFMarker = function MFMarker(props) {
|
|
|
1008
1152
|
if (theMap) {
|
|
1009
1153
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
1010
1154
|
var _markerRef$current3;
|
|
1155
|
+
|
|
1011
1156
|
(_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : _markerRef$current3.setMap(theMap);
|
|
1012
1157
|
}
|
|
1013
1158
|
}
|
|
1159
|
+
|
|
1014
1160
|
return function () {
|
|
1015
1161
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
1016
1162
|
var _markerRef$current4;
|
|
1163
|
+
|
|
1017
1164
|
(_markerRef$current4 = markerRef.current) === null || _markerRef$current4 === void 0 ? void 0 : _markerRef$current4.setMap(null);
|
|
1018
1165
|
}
|
|
1019
1166
|
};
|
|
@@ -1022,8 +1169,10 @@ var MFMarker = function MFMarker(props) {
|
|
|
1022
1169
|
return function () {
|
|
1023
1170
|
if (!(markerClusterContext !== null && markerClusterContext !== void 0 && markerClusterContext.addMarker)) {
|
|
1024
1171
|
var _markerRef$current5;
|
|
1172
|
+
|
|
1025
1173
|
(_markerRef$current5 = markerRef.current) === null || _markerRef$current5 === void 0 ? void 0 : _markerRef$current5.setMap(null);
|
|
1026
1174
|
}
|
|
1175
|
+
|
|
1027
1176
|
markerRef.current && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker) && (markerClusterContext === null || markerClusterContext === void 0 ? void 0 : markerClusterContext.removeMarker(markerRef.current));
|
|
1028
1177
|
};
|
|
1029
1178
|
}, []);
|
|
@@ -1064,79 +1213,98 @@ var MFMarker = function MFMarker(props) {
|
|
|
1064
1213
|
}, [onDragEnd]);
|
|
1065
1214
|
useEffect(function () {
|
|
1066
1215
|
var _markerRef$current6;
|
|
1216
|
+
|
|
1067
1217
|
(_markerRef$current6 = markerRef.current) === null || _markerRef$current6 === void 0 ? void 0 : _markerRef$current6.setPosition(position);
|
|
1068
1218
|
}, [position]);
|
|
1069
1219
|
useEffect(function () {
|
|
1070
1220
|
var _markerRef$current7;
|
|
1221
|
+
|
|
1071
1222
|
(_markerRef$current7 = markerRef.current) === null || _markerRef$current7 === void 0 ? void 0 : _markerRef$current7.setVisible(visible);
|
|
1072
1223
|
}, [visible]);
|
|
1073
1224
|
useEffect(function () {
|
|
1074
1225
|
var _markerRef$current8;
|
|
1226
|
+
|
|
1075
1227
|
anchor != undefined && ((_markerRef$current8 = markerRef.current) === null || _markerRef$current8 === void 0 ? void 0 : _markerRef$current8.setAnchor(anchor));
|
|
1076
1228
|
}, [anchor]);
|
|
1077
1229
|
useEffect(function () {
|
|
1078
1230
|
var _markerRef$current9;
|
|
1231
|
+
|
|
1079
1232
|
labelAnchor != undefined && ((_markerRef$current9 = markerRef.current) === null || _markerRef$current9 === void 0 ? void 0 : _markerRef$current9.setLabelAnchor(labelAnchor));
|
|
1080
1233
|
}, [labelAnchor]);
|
|
1081
1234
|
useEffect(function () {
|
|
1082
1235
|
var _markerRef$current10;
|
|
1236
|
+
|
|
1083
1237
|
icon != undefined && ((_markerRef$current10 = markerRef.current) === null || _markerRef$current10 === void 0 ? void 0 : _markerRef$current10.setIcon(icon));
|
|
1084
1238
|
}, [icon]);
|
|
1085
1239
|
useEffect(function () {
|
|
1086
1240
|
var _markerRef$current11;
|
|
1241
|
+
|
|
1087
1242
|
elevation != undefined && ((_markerRef$current11 = markerRef.current) === null || _markerRef$current11 === void 0 ? void 0 : _markerRef$current11.setElevation(elevation));
|
|
1088
1243
|
}, [elevation]);
|
|
1089
1244
|
useEffect(function () {
|
|
1090
1245
|
var _markerRef$current12;
|
|
1246
|
+
|
|
1091
1247
|
rotation != undefined && ((_markerRef$current12 = markerRef.current) === null || _markerRef$current12 === void 0 ? void 0 : _markerRef$current12.setRotation(rotation));
|
|
1092
1248
|
}, [rotation]);
|
|
1093
1249
|
useEffect(function () {
|
|
1094
1250
|
var _markerRef$current13;
|
|
1251
|
+
|
|
1095
1252
|
title != undefined && ((_markerRef$current13 = markerRef.current) === null || _markerRef$current13 === void 0 ? void 0 : _markerRef$current13.setTitle(title));
|
|
1096
1253
|
}, [title]);
|
|
1097
1254
|
useEffect(function () {
|
|
1098
1255
|
var _markerRef$current14;
|
|
1256
|
+
|
|
1099
1257
|
snippet != undefined && ((_markerRef$current14 = markerRef.current) === null || _markerRef$current14 === void 0 ? void 0 : _markerRef$current14.setSnippet(snippet));
|
|
1100
1258
|
}, [snippet]);
|
|
1101
1259
|
useEffect(function () {
|
|
1102
1260
|
var _markerRef$current15;
|
|
1261
|
+
|
|
1103
1262
|
windowAnchor != undefined && ((_markerRef$current15 = markerRef.current) === null || _markerRef$current15 === void 0 ? void 0 : _markerRef$current15.setWindowAnchor(windowAnchor));
|
|
1104
1263
|
}, [windowAnchor]);
|
|
1105
1264
|
useEffect(function () {
|
|
1106
1265
|
var _markerRef$current16;
|
|
1266
|
+
|
|
1107
1267
|
zIndex != undefined && ((_markerRef$current16 = markerRef.current) === null || _markerRef$current16 === void 0 ? void 0 : _markerRef$current16.setZIndex(zIndex));
|
|
1108
1268
|
}, [zIndex]);
|
|
1109
1269
|
useEffect(function () {
|
|
1110
1270
|
var _markerRef$current17;
|
|
1271
|
+
|
|
1111
1272
|
label != undefined && ((_markerRef$current17 = markerRef.current) === null || _markerRef$current17 === void 0 ? void 0 : _markerRef$current17.setLabel(label));
|
|
1112
1273
|
}, [label]);
|
|
1113
1274
|
useEffect(function () {
|
|
1114
1275
|
var _markerRef$current18;
|
|
1276
|
+
|
|
1115
1277
|
draggable != undefined && ((_markerRef$current18 = markerRef.current) === null || _markerRef$current18 === void 0 ? void 0 : _markerRef$current18.setDraggable(draggable));
|
|
1116
1278
|
}, [draggable]);
|
|
1117
1279
|
useEffect(function () {
|
|
1118
1280
|
var _markerRef$current19;
|
|
1281
|
+
|
|
1119
1282
|
iconView != undefined && ((_markerRef$current19 = markerRef.current) === null || _markerRef$current19 === void 0 ? void 0 : _markerRef$current19.setIconView(iconView));
|
|
1120
1283
|
}, [iconView]);
|
|
1121
1284
|
useEffect(function () {
|
|
1122
1285
|
var _markerRef$current20;
|
|
1123
|
-
|
|
1124
|
-
|
|
1286
|
+
|
|
1287
|
+
clickable != undefined && ((_markerRef$current20 = markerRef.current) === null || _markerRef$current20 === void 0 ? void 0 : _markerRef$current20.setClickable(clickable));
|
|
1288
|
+
}, [clickable]);
|
|
1125
1289
|
useEffect(function () {
|
|
1126
1290
|
var _markerRef$current21;
|
|
1291
|
+
|
|
1127
1292
|
icon != undefined && ((_markerRef$current21 = markerRef.current) === null || _markerRef$current21 === void 0 ? void 0 : _markerRef$current21.setIcon(new map4d.Icon(icon.width, icon.height, icon.url)));
|
|
1128
1293
|
}, [icon]);
|
|
1129
1294
|
useEffect(function () {
|
|
1130
1295
|
var _markerRef$current22;
|
|
1296
|
+
|
|
1131
1297
|
props.infoWindow != undefined && ((_markerRef$current22 = markerRef.current) === null || _markerRef$current22 === void 0 ? void 0 : _markerRef$current22.setInfoWindow(props.infoWindow));
|
|
1132
1298
|
}, [props.infoWindow]);
|
|
1133
1299
|
useEffect(function () {
|
|
1134
1300
|
var _markerRef$current23;
|
|
1301
|
+
|
|
1135
1302
|
props.infoContents != undefined && ((_markerRef$current23 = markerRef.current) === null || _markerRef$current23 === void 0 ? void 0 : _markerRef$current23.setInfoContents(props.infoContents));
|
|
1136
1303
|
}, [props.infoContents]);
|
|
1137
1304
|
useEffect(function () {
|
|
1138
1305
|
if (props.showInfoWindow != undefined) {
|
|
1139
1306
|
var _markerRef$current24, _markerRef$current25;
|
|
1307
|
+
|
|
1140
1308
|
props.showInfoWindow ? (_markerRef$current24 = markerRef.current) === null || _markerRef$current24 === void 0 ? void 0 : _markerRef$current24.showInfoWindow() : (_markerRef$current25 = markerRef.current) === null || _markerRef$current25 === void 0 ? void 0 : _markerRef$current25.hideInfoWindow();
|
|
1141
1309
|
}
|
|
1142
1310
|
}, [props.showInfoWindow]);
|
|
@@ -1145,23 +1313,27 @@ var MFMarker = function MFMarker(props) {
|
|
|
1145
1313
|
|
|
1146
1314
|
var MFMarkerCluster = function MFMarkerCluster(props) {
|
|
1147
1315
|
var _props$minZoom = props.minZoom,
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1316
|
+
minZoom = _props$minZoom === void 0 ? 0 : _props$minZoom,
|
|
1317
|
+
_props$maxZoom = props.maxZoom,
|
|
1318
|
+
maxZoom = _props$maxZoom === void 0 ? 22 : _props$maxZoom,
|
|
1319
|
+
_props$radius = props.radius,
|
|
1320
|
+
radius = _props$radius === void 0 ? 100 : _props$radius,
|
|
1321
|
+
zoomOnClick = props.zoomOnClick,
|
|
1322
|
+
map = props.map,
|
|
1323
|
+
onCreated = props.onCreated;
|
|
1156
1324
|
var map4dContext = useContext(Map4dContext);
|
|
1157
1325
|
var theMap = map || map4dContext.map;
|
|
1158
1326
|
var markerRefs = useRef([]);
|
|
1159
1327
|
var markerClusterRef = useRef();
|
|
1328
|
+
|
|
1160
1329
|
var drawCluster = function drawCluster() {
|
|
1161
1330
|
var _markerClusterRef$cur;
|
|
1331
|
+
|
|
1162
1332
|
(_markerClusterRef$cur = markerClusterRef.current) === null || _markerClusterRef$cur === void 0 ? void 0 : _markerClusterRef$cur.setMap(null);
|
|
1333
|
+
|
|
1163
1334
|
if (theMap) {
|
|
1164
1335
|
var _markerClusterRef$cur2;
|
|
1336
|
+
|
|
1165
1337
|
var option = {
|
|
1166
1338
|
minZoom: minZoom,
|
|
1167
1339
|
maxZoom: maxZoom,
|
|
@@ -1178,6 +1350,7 @@ var MFMarkerCluster = function MFMarkerCluster(props) {
|
|
|
1178
1350
|
onCreated && onCreated(markerClusterRef.current);
|
|
1179
1351
|
}
|
|
1180
1352
|
};
|
|
1353
|
+
|
|
1181
1354
|
var clusterContext = {
|
|
1182
1355
|
addMarker: function addMarker(marker) {
|
|
1183
1356
|
markerRefs.current.push(marker);
|
|
@@ -1199,16 +1372,20 @@ var MFMarkerCluster = function MFMarkerCluster(props) {
|
|
|
1199
1372
|
useEffect(function () {
|
|
1200
1373
|
if (theMap) {
|
|
1201
1374
|
var _markerClusterRef$cur3;
|
|
1375
|
+
|
|
1202
1376
|
(_markerClusterRef$cur3 = markerClusterRef.current) === null || _markerClusterRef$cur3 === void 0 ? void 0 : _markerClusterRef$cur3.setMap(theMap);
|
|
1203
1377
|
}
|
|
1378
|
+
|
|
1204
1379
|
return function () {
|
|
1205
1380
|
var _markerClusterRef$cur4;
|
|
1381
|
+
|
|
1206
1382
|
(_markerClusterRef$cur4 = markerClusterRef.current) === null || _markerClusterRef$cur4 === void 0 ? void 0 : _markerClusterRef$cur4.setMap(null);
|
|
1207
1383
|
};
|
|
1208
1384
|
}, [theMap]);
|
|
1209
1385
|
useEffect(function () {
|
|
1210
1386
|
return function () {
|
|
1211
1387
|
var _markerClusterRef$cur5;
|
|
1388
|
+
|
|
1212
1389
|
(_markerClusterRef$cur5 = markerClusterRef.current) === null || _markerClusterRef$cur5 === void 0 ? void 0 : _markerClusterRef$cur5.setMap(null);
|
|
1213
1390
|
};
|
|
1214
1391
|
}, []);
|
|
@@ -1219,6 +1396,7 @@ var MFMarkerCluster = function MFMarkerCluster(props) {
|
|
|
1219
1396
|
}, [minZoom, maxZoom, radius]);
|
|
1220
1397
|
useEffect(function () {
|
|
1221
1398
|
var _markerClusterRef$cur6;
|
|
1399
|
+
|
|
1222
1400
|
zoomOnClick != undefined && ((_markerClusterRef$cur6 = markerClusterRef.current) === null || _markerClusterRef$cur6 === void 0 ? void 0 : _markerClusterRef$cur6.setZoomOnClick(zoomOnClick));
|
|
1223
1401
|
}, [zoomOnClick]);
|
|
1224
1402
|
return React.createElement(MarkerClusterContext.Provider, {
|
|
@@ -1228,26 +1406,27 @@ var MFMarkerCluster = function MFMarkerCluster(props) {
|
|
|
1228
1406
|
|
|
1229
1407
|
var MFPOI = function MFPOI(props) {
|
|
1230
1408
|
var position = props.position,
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1409
|
+
title = props.title,
|
|
1410
|
+
subtitle = props.subtitle,
|
|
1411
|
+
color = props.color,
|
|
1412
|
+
type = props.type,
|
|
1413
|
+
icon = props.icon,
|
|
1414
|
+
elevation = props.elevation,
|
|
1415
|
+
zIndex = props.zIndex,
|
|
1416
|
+
visible = props.visible,
|
|
1417
|
+
draggable = props.draggable,
|
|
1418
|
+
clickable = props.clickable,
|
|
1419
|
+
map = props.map,
|
|
1420
|
+
onCreated = props.onCreated,
|
|
1421
|
+
onClick = props.onClick,
|
|
1422
|
+
onHover = props.onHover;
|
|
1245
1423
|
var map4dContext = useContext(Map4dContext);
|
|
1246
1424
|
var theMap = map || map4dContext.map;
|
|
1247
1425
|
var poiRef = useRef();
|
|
1248
1426
|
useEffect(function () {
|
|
1249
1427
|
if (theMap && !poiRef.current) {
|
|
1250
1428
|
var _poiRef$current;
|
|
1429
|
+
|
|
1251
1430
|
var option = {
|
|
1252
1431
|
position: position || {
|
|
1253
1432
|
lat: 10.793113,
|
|
@@ -1262,7 +1441,7 @@ var MFPOI = function MFPOI(props) {
|
|
|
1262
1441
|
zIndex: zIndex,
|
|
1263
1442
|
visible: visible,
|
|
1264
1443
|
draggable: draggable,
|
|
1265
|
-
|
|
1444
|
+
clickable: clickable
|
|
1266
1445
|
};
|
|
1267
1446
|
Object.keys(option).forEach(function (key) {
|
|
1268
1447
|
if (option[key] == undefined || option[key] == null) {
|
|
@@ -1279,63 +1458,78 @@ var MFPOI = function MFPOI(props) {
|
|
|
1279
1458
|
useEffect(function () {
|
|
1280
1459
|
if (theMap) {
|
|
1281
1460
|
var _poiRef$current2;
|
|
1461
|
+
|
|
1282
1462
|
(_poiRef$current2 = poiRef.current) === null || _poiRef$current2 === void 0 ? void 0 : _poiRef$current2.setMap(theMap);
|
|
1283
1463
|
}
|
|
1464
|
+
|
|
1284
1465
|
return function () {
|
|
1285
1466
|
var _poiRef$current3;
|
|
1467
|
+
|
|
1286
1468
|
(_poiRef$current3 = poiRef.current) === null || _poiRef$current3 === void 0 ? void 0 : _poiRef$current3.setMap(null);
|
|
1287
1469
|
};
|
|
1288
1470
|
}, [theMap]);
|
|
1289
1471
|
useEffect(function () {
|
|
1290
1472
|
return function () {
|
|
1291
1473
|
var _poiRef$current4;
|
|
1474
|
+
|
|
1292
1475
|
(_poiRef$current4 = poiRef.current) === null || _poiRef$current4 === void 0 ? void 0 : _poiRef$current4.setMap(null);
|
|
1293
1476
|
};
|
|
1294
1477
|
}, []);
|
|
1295
1478
|
useEffect(function () {
|
|
1296
1479
|
var _poiRef$current5;
|
|
1480
|
+
|
|
1297
1481
|
(_poiRef$current5 = poiRef.current) === null || _poiRef$current5 === void 0 ? void 0 : _poiRef$current5.setPosition(position);
|
|
1298
1482
|
}, [position]);
|
|
1299
1483
|
useEffect(function () {
|
|
1300
1484
|
var _poiRef$current6;
|
|
1485
|
+
|
|
1301
1486
|
title != undefined && ((_poiRef$current6 = poiRef.current) === null || _poiRef$current6 === void 0 ? void 0 : _poiRef$current6.setTitle(title));
|
|
1302
1487
|
}, [title]);
|
|
1303
1488
|
useEffect(function () {
|
|
1304
1489
|
var _poiRef$current7;
|
|
1490
|
+
|
|
1305
1491
|
subtitle != undefined && ((_poiRef$current7 = poiRef.current) === null || _poiRef$current7 === void 0 ? void 0 : _poiRef$current7.setSubtitle(subtitle));
|
|
1306
1492
|
}, [subtitle]);
|
|
1307
1493
|
useEffect(function () {
|
|
1308
1494
|
var _poiRef$current8;
|
|
1495
|
+
|
|
1309
1496
|
color != undefined && ((_poiRef$current8 = poiRef.current) === null || _poiRef$current8 === void 0 ? void 0 : _poiRef$current8.setColor(color));
|
|
1310
1497
|
}, [color]);
|
|
1311
1498
|
useEffect(function () {
|
|
1312
1499
|
var _poiRef$current9;
|
|
1500
|
+
|
|
1313
1501
|
type != undefined && ((_poiRef$current9 = poiRef.current) === null || _poiRef$current9 === void 0 ? void 0 : _poiRef$current9.setType(type));
|
|
1314
1502
|
}, [type]);
|
|
1315
1503
|
useEffect(function () {
|
|
1316
1504
|
var _poiRef$current10;
|
|
1505
|
+
|
|
1317
1506
|
icon != undefined && ((_poiRef$current10 = poiRef.current) === null || _poiRef$current10 === void 0 ? void 0 : _poiRef$current10.setIcon(icon));
|
|
1318
1507
|
}, [icon]);
|
|
1319
1508
|
useEffect(function () {
|
|
1320
1509
|
var _poiRef$current11;
|
|
1510
|
+
|
|
1321
1511
|
elevation != undefined && ((_poiRef$current11 = poiRef.current) === null || _poiRef$current11 === void 0 ? void 0 : _poiRef$current11.setElevation(elevation));
|
|
1322
1512
|
}, [elevation]);
|
|
1323
1513
|
useEffect(function () {
|
|
1324
1514
|
var _poiRef$current12;
|
|
1515
|
+
|
|
1325
1516
|
zIndex != undefined && ((_poiRef$current12 = poiRef.current) === null || _poiRef$current12 === void 0 ? void 0 : _poiRef$current12.setZIndex(zIndex));
|
|
1326
1517
|
}, [zIndex]);
|
|
1327
1518
|
useEffect(function () {
|
|
1328
1519
|
var _poiRef$current13;
|
|
1520
|
+
|
|
1329
1521
|
visible != undefined && ((_poiRef$current13 = poiRef.current) === null || _poiRef$current13 === void 0 ? void 0 : _poiRef$current13.setVisible(visible));
|
|
1330
1522
|
}, [visible]);
|
|
1331
1523
|
useEffect(function () {
|
|
1332
1524
|
var _poiRef$current14;
|
|
1525
|
+
|
|
1333
1526
|
draggable != undefined && ((_poiRef$current14 = poiRef.current) === null || _poiRef$current14 === void 0 ? void 0 : _poiRef$current14.setDraggable(draggable));
|
|
1334
1527
|
}, [draggable]);
|
|
1335
1528
|
useEffect(function () {
|
|
1336
1529
|
var _poiRef$current15;
|
|
1337
|
-
|
|
1338
|
-
|
|
1530
|
+
|
|
1531
|
+
clickable != undefined && ((_poiRef$current15 = poiRef.current) === null || _poiRef$current15 === void 0 ? void 0 : _poiRef$current15.setClickable(clickable));
|
|
1532
|
+
}, [clickable]);
|
|
1339
1533
|
useEffect(function () {
|
|
1340
1534
|
if (poiRef.current) {
|
|
1341
1535
|
poiRef.current.onClick = onClick;
|
|
@@ -1351,17 +1545,19 @@ var MFPOI = function MFPOI(props) {
|
|
|
1351
1545
|
|
|
1352
1546
|
var MFPOIOverlay = function MFPOIOverlay(props) {
|
|
1353
1547
|
var getUrl = props.getUrl,
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1548
|
+
_props$visible = props.visible,
|
|
1549
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
1550
|
+
parserData = props.parserData,
|
|
1551
|
+
prefixId = props.prefixId,
|
|
1552
|
+
map = props.map,
|
|
1553
|
+
onCreated = props.onCreated;
|
|
1360
1554
|
var map4dContext = useContext(Map4dContext);
|
|
1361
1555
|
var theMap = map || map4dContext.map;
|
|
1362
1556
|
var poiOverlayRef = useRef();
|
|
1557
|
+
|
|
1363
1558
|
var reCreate = function reCreate() {
|
|
1364
1559
|
var _poiOverlayRef$curren, _poiOverlayRef$curren2;
|
|
1560
|
+
|
|
1365
1561
|
(_poiOverlayRef$curren = poiOverlayRef.current) === null || _poiOverlayRef$curren === void 0 ? void 0 : _poiOverlayRef$curren.setMap(null);
|
|
1366
1562
|
var option = {
|
|
1367
1563
|
getUrl: getUrl || {
|
|
@@ -1381,6 +1577,7 @@ var MFPOIOverlay = function MFPOIOverlay(props) {
|
|
|
1381
1577
|
(_poiOverlayRef$curren2 = poiOverlayRef.current) === null || _poiOverlayRef$curren2 === void 0 ? void 0 : _poiOverlayRef$curren2.setMap(theMap);
|
|
1382
1578
|
onCreated && onCreated(poiOverlayRef.current);
|
|
1383
1579
|
};
|
|
1580
|
+
|
|
1384
1581
|
useEffect(function () {
|
|
1385
1582
|
if (theMap && !poiOverlayRef.current) {
|
|
1386
1583
|
reCreate();
|
|
@@ -1389,16 +1586,20 @@ var MFPOIOverlay = function MFPOIOverlay(props) {
|
|
|
1389
1586
|
useEffect(function () {
|
|
1390
1587
|
if (theMap) {
|
|
1391
1588
|
var _poiOverlayRef$curren3;
|
|
1589
|
+
|
|
1392
1590
|
(_poiOverlayRef$curren3 = poiOverlayRef.current) === null || _poiOverlayRef$curren3 === void 0 ? void 0 : _poiOverlayRef$curren3.setMap(theMap);
|
|
1393
1591
|
}
|
|
1592
|
+
|
|
1394
1593
|
return function () {
|
|
1395
1594
|
var _poiOverlayRef$curren4;
|
|
1595
|
+
|
|
1396
1596
|
(_poiOverlayRef$curren4 = poiOverlayRef.current) === null || _poiOverlayRef$curren4 === void 0 ? void 0 : _poiOverlayRef$curren4.setMap(null);
|
|
1397
1597
|
};
|
|
1398
1598
|
}, [theMap]);
|
|
1399
1599
|
useEffect(function () {
|
|
1400
1600
|
return function () {
|
|
1401
1601
|
var _poiOverlayRef$curren5;
|
|
1602
|
+
|
|
1402
1603
|
(_poiOverlayRef$curren5 = poiOverlayRef.current) === null || _poiOverlayRef$curren5 === void 0 ? void 0 : _poiOverlayRef$curren5.setMap(null);
|
|
1403
1604
|
};
|
|
1404
1605
|
}, []);
|
|
@@ -1412,19 +1613,19 @@ var MFPOIOverlay = function MFPOIOverlay(props) {
|
|
|
1412
1613
|
|
|
1413
1614
|
var MFPolygon = function MFPolygon(props) {
|
|
1414
1615
|
var paths = props.paths,
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1616
|
+
fillColor = props.fillColor,
|
|
1617
|
+
fillOpacity = props.fillOpacity,
|
|
1618
|
+
_props$visible = props.visible,
|
|
1619
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
1620
|
+
strokeColor = props.strokeColor,
|
|
1621
|
+
strokeWidth = props.strokeWidth,
|
|
1622
|
+
draggable = props.draggable,
|
|
1623
|
+
elevation = props.elevation,
|
|
1624
|
+
zIndex = props.zIndex,
|
|
1625
|
+
clickable = props.clickable,
|
|
1626
|
+
map = props.map,
|
|
1627
|
+
onHover = props.onHover,
|
|
1628
|
+
onCreated = props.onCreated;
|
|
1428
1629
|
var map4dContext = useContext(Map4dContext);
|
|
1429
1630
|
var theMap = map || map4dContext.map;
|
|
1430
1631
|
var polygonRef = useRef();
|
|
@@ -1432,6 +1633,7 @@ var MFPolygon = function MFPolygon(props) {
|
|
|
1432
1633
|
useEffect(function () {
|
|
1433
1634
|
if (theMap && !polygonRef.current) {
|
|
1434
1635
|
var _polygonRef$current;
|
|
1636
|
+
|
|
1435
1637
|
var option = {
|
|
1436
1638
|
paths: paths,
|
|
1437
1639
|
fillColor: fillColor,
|
|
@@ -1442,7 +1644,7 @@ var MFPolygon = function MFPolygon(props) {
|
|
|
1442
1644
|
draggable: draggable,
|
|
1443
1645
|
elevation: elevation,
|
|
1444
1646
|
zIndex: zIndex,
|
|
1445
|
-
|
|
1647
|
+
clickable: clickable
|
|
1446
1648
|
};
|
|
1447
1649
|
Object.keys(option).forEach(function (key) {
|
|
1448
1650
|
if (option[key] == undefined || option[key] == null) {
|
|
@@ -1460,16 +1662,20 @@ var MFPolygon = function MFPolygon(props) {
|
|
|
1460
1662
|
useEffect(function () {
|
|
1461
1663
|
if (theMap) {
|
|
1462
1664
|
var _polygonRef$current2;
|
|
1665
|
+
|
|
1463
1666
|
(_polygonRef$current2 = polygonRef.current) === null || _polygonRef$current2 === void 0 ? void 0 : _polygonRef$current2.setMap(theMap);
|
|
1464
1667
|
}
|
|
1668
|
+
|
|
1465
1669
|
return function () {
|
|
1466
1670
|
var _polygonRef$current3;
|
|
1671
|
+
|
|
1467
1672
|
(_polygonRef$current3 = polygonRef.current) === null || _polygonRef$current3 === void 0 ? void 0 : _polygonRef$current3.setMap(null);
|
|
1468
1673
|
};
|
|
1469
1674
|
}, [theMap]);
|
|
1470
1675
|
useEffect(function () {
|
|
1471
1676
|
return function () {
|
|
1472
1677
|
var _polygonRef$current4;
|
|
1678
|
+
|
|
1473
1679
|
(_polygonRef$current4 = polygonRef.current) === null || _polygonRef$current4 === void 0 ? void 0 : _polygonRef$current4.setMap(null);
|
|
1474
1680
|
};
|
|
1475
1681
|
}, []);
|
|
@@ -1480,78 +1686,91 @@ var MFPolygon = function MFPolygon(props) {
|
|
|
1480
1686
|
}, [onHover]);
|
|
1481
1687
|
useEffect(function () {
|
|
1482
1688
|
var _polygonRef$current6;
|
|
1689
|
+
|
|
1483
1690
|
if (polygonRef.current) {
|
|
1484
1691
|
var _polygonRef$current5;
|
|
1692
|
+
|
|
1485
1693
|
var c = (_polygonRef$current5 = polygonRef.current) === null || _polygonRef$current5 === void 0 ? void 0 : _polygonRef$current5.getMap();
|
|
1486
1694
|
console.log(c == a.current);
|
|
1487
1695
|
}
|
|
1696
|
+
|
|
1488
1697
|
(_polygonRef$current6 = polygonRef.current) === null || _polygonRef$current6 === void 0 ? void 0 : _polygonRef$current6.setPaths(paths);
|
|
1489
1698
|
}, [paths]);
|
|
1490
1699
|
useEffect(function () {
|
|
1491
1700
|
var _polygonRef$current7;
|
|
1701
|
+
|
|
1492
1702
|
fillColor != undefined && ((_polygonRef$current7 = polygonRef.current) === null || _polygonRef$current7 === void 0 ? void 0 : _polygonRef$current7.setFillColor(fillColor));
|
|
1493
1703
|
}, [fillColor]);
|
|
1494
1704
|
useEffect(function () {
|
|
1495
1705
|
var _polygonRef$current8;
|
|
1706
|
+
|
|
1496
1707
|
fillOpacity != undefined && ((_polygonRef$current8 = polygonRef.current) === null || _polygonRef$current8 === void 0 ? void 0 : _polygonRef$current8.setFillOpacity(fillOpacity));
|
|
1497
1708
|
}, [fillOpacity]);
|
|
1498
1709
|
useEffect(function () {
|
|
1499
1710
|
var _polygonRef$current9;
|
|
1711
|
+
|
|
1500
1712
|
(_polygonRef$current9 = polygonRef.current) === null || _polygonRef$current9 === void 0 ? void 0 : _polygonRef$current9.setVisible(visible);
|
|
1501
1713
|
}, [visible]);
|
|
1502
1714
|
useEffect(function () {
|
|
1503
1715
|
var _polygonRef$current10;
|
|
1716
|
+
|
|
1504
1717
|
strokeColor != undefined && ((_polygonRef$current10 = polygonRef.current) === null || _polygonRef$current10 === void 0 ? void 0 : _polygonRef$current10.setStrokeColor(strokeColor));
|
|
1505
1718
|
}, [strokeColor]);
|
|
1506
1719
|
useEffect(function () {
|
|
1507
1720
|
var _polygonRef$current11;
|
|
1721
|
+
|
|
1508
1722
|
strokeWidth != undefined && ((_polygonRef$current11 = polygonRef.current) === null || _polygonRef$current11 === void 0 ? void 0 : _polygonRef$current11.setStrokeWidth(strokeWidth));
|
|
1509
1723
|
}, [strokeWidth]);
|
|
1510
1724
|
useEffect(function () {
|
|
1511
1725
|
var _polygonRef$current12;
|
|
1726
|
+
|
|
1512
1727
|
draggable != undefined && ((_polygonRef$current12 = polygonRef.current) === null || _polygonRef$current12 === void 0 ? void 0 : _polygonRef$current12.setDraggable(draggable));
|
|
1513
1728
|
}, [draggable]);
|
|
1514
1729
|
useEffect(function () {
|
|
1515
1730
|
var _polygonRef$current13;
|
|
1731
|
+
|
|
1516
1732
|
elevation != undefined && ((_polygonRef$current13 = polygonRef.current) === null || _polygonRef$current13 === void 0 ? void 0 : _polygonRef$current13.setElevation(elevation));
|
|
1517
1733
|
}, [elevation]);
|
|
1518
1734
|
useEffect(function () {
|
|
1519
1735
|
var _polygonRef$current14;
|
|
1736
|
+
|
|
1520
1737
|
zIndex != undefined && ((_polygonRef$current14 = polygonRef.current) === null || _polygonRef$current14 === void 0 ? void 0 : _polygonRef$current14.setZIndex(zIndex));
|
|
1521
1738
|
}, [zIndex]);
|
|
1522
1739
|
useEffect(function () {
|
|
1523
1740
|
var _polygonRef$current15;
|
|
1524
|
-
|
|
1525
|
-
|
|
1741
|
+
|
|
1742
|
+
clickable != undefined && ((_polygonRef$current15 = polygonRef.current) === null || _polygonRef$current15 === void 0 ? void 0 : _polygonRef$current15.setClickable(clickable));
|
|
1743
|
+
}, [clickable]);
|
|
1526
1744
|
return null;
|
|
1527
1745
|
};
|
|
1528
1746
|
|
|
1529
1747
|
var MFPolyline = function MFPolyline(props) {
|
|
1530
1748
|
var path = props.path,
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1749
|
+
strokeWidth = props.strokeWidth,
|
|
1750
|
+
strokeColor = props.strokeColor,
|
|
1751
|
+
strokeOpacity = props.strokeOpacity,
|
|
1752
|
+
_props$visible = props.visible,
|
|
1753
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
1754
|
+
closed = props.closed,
|
|
1755
|
+
draggable = props.draggable,
|
|
1756
|
+
zIndex = props.zIndex,
|
|
1757
|
+
elevation = props.elevation,
|
|
1758
|
+
strokePattern = props.strokePattern,
|
|
1759
|
+
clickable = props.clickable,
|
|
1760
|
+
map = props.map,
|
|
1761
|
+
onClick = props.onClick,
|
|
1762
|
+
onHover = props.onHover,
|
|
1763
|
+
onCreated = props.onCreated,
|
|
1764
|
+
onMouseOut = props.onMouseOut,
|
|
1765
|
+
onMouseOver = props.onMouseOver,
|
|
1766
|
+
onMouseMove = props.onMouseMove;
|
|
1549
1767
|
var map4dContext = useContext(Map4dContext);
|
|
1550
1768
|
var theMap = map || map4dContext.map;
|
|
1551
1769
|
var polylineRef = useRef();
|
|
1552
1770
|
useEffect(function () {
|
|
1553
1771
|
if (theMap && !polylineRef.current) {
|
|
1554
1772
|
var _polylineRef$current;
|
|
1773
|
+
|
|
1555
1774
|
var option = {
|
|
1556
1775
|
path: path || {
|
|
1557
1776
|
lat: 10.793113,
|
|
@@ -1566,7 +1785,7 @@ var MFPolyline = function MFPolyline(props) {
|
|
|
1566
1785
|
zIndex: zIndex,
|
|
1567
1786
|
elevation: elevation,
|
|
1568
1787
|
strokePattern: strokePattern,
|
|
1569
|
-
|
|
1788
|
+
clickable: clickable
|
|
1570
1789
|
};
|
|
1571
1790
|
Object.keys(option).forEach(function (key) {
|
|
1572
1791
|
if (option[key] == undefined || option[key] == null) {
|
|
@@ -1586,16 +1805,20 @@ var MFPolyline = function MFPolyline(props) {
|
|
|
1586
1805
|
useEffect(function () {
|
|
1587
1806
|
if (theMap) {
|
|
1588
1807
|
var _polylineRef$current2;
|
|
1808
|
+
|
|
1589
1809
|
(_polylineRef$current2 = polylineRef.current) === null || _polylineRef$current2 === void 0 ? void 0 : _polylineRef$current2.setMap(theMap);
|
|
1590
1810
|
}
|
|
1811
|
+
|
|
1591
1812
|
return function () {
|
|
1592
1813
|
var _polylineRef$current3;
|
|
1814
|
+
|
|
1593
1815
|
(_polylineRef$current3 = polylineRef.current) === null || _polylineRef$current3 === void 0 ? void 0 : _polylineRef$current3.setMap(null);
|
|
1594
1816
|
};
|
|
1595
1817
|
}, [theMap]);
|
|
1596
1818
|
useEffect(function () {
|
|
1597
1819
|
return function () {
|
|
1598
1820
|
var _polylineRef$current4;
|
|
1821
|
+
|
|
1599
1822
|
(_polylineRef$current4 = polylineRef.current) === null || _polylineRef$current4 === void 0 ? void 0 : _polylineRef$current4.setMap(null);
|
|
1600
1823
|
};
|
|
1601
1824
|
}, []);
|
|
@@ -1626,64 +1849,77 @@ var MFPolyline = function MFPolyline(props) {
|
|
|
1626
1849
|
}, [onClick]);
|
|
1627
1850
|
useEffect(function () {
|
|
1628
1851
|
var _polylineRef$current5;
|
|
1852
|
+
|
|
1629
1853
|
(_polylineRef$current5 = polylineRef.current) === null || _polylineRef$current5 === void 0 ? void 0 : _polylineRef$current5.setPath(path);
|
|
1630
1854
|
}, [path]);
|
|
1631
1855
|
useEffect(function () {
|
|
1632
1856
|
var _polylineRef$current6;
|
|
1857
|
+
|
|
1633
1858
|
strokeWidth != undefined && ((_polylineRef$current6 = polylineRef.current) === null || _polylineRef$current6 === void 0 ? void 0 : _polylineRef$current6.setStrokeWidth(strokeWidth));
|
|
1634
1859
|
}, [strokeWidth]);
|
|
1635
1860
|
useEffect(function () {
|
|
1636
1861
|
var _polylineRef$current7;
|
|
1862
|
+
|
|
1637
1863
|
strokeColor != undefined && ((_polylineRef$current7 = polylineRef.current) === null || _polylineRef$current7 === void 0 ? void 0 : _polylineRef$current7.setStrokeColor(strokeColor));
|
|
1638
1864
|
}, [strokeColor]);
|
|
1639
1865
|
useEffect(function () {
|
|
1640
1866
|
var _polylineRef$current8;
|
|
1867
|
+
|
|
1641
1868
|
strokeOpacity != undefined && ((_polylineRef$current8 = polylineRef.current) === null || _polylineRef$current8 === void 0 ? void 0 : _polylineRef$current8.setStrokeOpacity(strokeOpacity));
|
|
1642
1869
|
}, [strokeOpacity]);
|
|
1643
1870
|
useEffect(function () {
|
|
1644
1871
|
var _polylineRef$current9;
|
|
1872
|
+
|
|
1645
1873
|
visible != undefined && ((_polylineRef$current9 = polylineRef.current) === null || _polylineRef$current9 === void 0 ? void 0 : _polylineRef$current9.setVisible(visible));
|
|
1646
1874
|
}, [visible]);
|
|
1647
1875
|
useEffect(function () {
|
|
1648
1876
|
var _polylineRef$current10;
|
|
1877
|
+
|
|
1649
1878
|
closed != undefined && ((_polylineRef$current10 = polylineRef.current) === null || _polylineRef$current10 === void 0 ? void 0 : _polylineRef$current10.setClosed(closed));
|
|
1650
1879
|
}, [closed]);
|
|
1651
1880
|
useEffect(function () {
|
|
1652
1881
|
var _polylineRef$current11;
|
|
1882
|
+
|
|
1653
1883
|
draggable != undefined && ((_polylineRef$current11 = polylineRef.current) === null || _polylineRef$current11 === void 0 ? void 0 : _polylineRef$current11.setDraggable(draggable));
|
|
1654
1884
|
}, [draggable]);
|
|
1655
1885
|
useEffect(function () {
|
|
1656
1886
|
var _polylineRef$current12;
|
|
1887
|
+
|
|
1657
1888
|
zIndex != undefined && ((_polylineRef$current12 = polylineRef.current) === null || _polylineRef$current12 === void 0 ? void 0 : _polylineRef$current12.setZIndex(zIndex));
|
|
1658
1889
|
}, [zIndex]);
|
|
1659
1890
|
useEffect(function () {
|
|
1660
1891
|
var _polylineRef$current13;
|
|
1892
|
+
|
|
1661
1893
|
elevation != undefined && ((_polylineRef$current13 = polylineRef.current) === null || _polylineRef$current13 === void 0 ? void 0 : _polylineRef$current13.setElevation(elevation));
|
|
1662
1894
|
}, [elevation]);
|
|
1663
1895
|
useEffect(function () {
|
|
1664
1896
|
var _polylineRef$current14;
|
|
1897
|
+
|
|
1665
1898
|
strokePattern != undefined && ((_polylineRef$current14 = polylineRef.current) === null || _polylineRef$current14 === void 0 ? void 0 : _polylineRef$current14.setStrokePattern(strokePattern));
|
|
1666
1899
|
}, [strokePattern]);
|
|
1667
1900
|
useEffect(function () {
|
|
1668
1901
|
var _polylineRef$current15;
|
|
1669
|
-
|
|
1670
|
-
|
|
1902
|
+
|
|
1903
|
+
clickable != undefined && ((_polylineRef$current15 = polylineRef.current) === null || _polylineRef$current15 === void 0 ? void 0 : _polylineRef$current15.setClickable(clickable));
|
|
1904
|
+
}, [clickable]);
|
|
1671
1905
|
return null;
|
|
1672
1906
|
};
|
|
1673
1907
|
|
|
1674
1908
|
var MFTileOverlay = function MFTileOverlay(props) {
|
|
1675
1909
|
var getUrl = props.getUrl,
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1910
|
+
_props$visible = props.visible,
|
|
1911
|
+
visible = _props$visible === void 0 ? true : _props$visible,
|
|
1912
|
+
zIndex = props.zIndex,
|
|
1913
|
+
opacity = props.opacity,
|
|
1914
|
+
map = props.map,
|
|
1915
|
+
onCreated = props.onCreated;
|
|
1682
1916
|
var map4dContext = useContext(Map4dContext);
|
|
1683
1917
|
var theMap = map || map4dContext.map;
|
|
1684
1918
|
var tileOverlayRef = useRef();
|
|
1919
|
+
|
|
1685
1920
|
var reCreate = function reCreate() {
|
|
1686
1921
|
var _tileOverlayRef$curre, _tileOverlayRef$curre2;
|
|
1922
|
+
|
|
1687
1923
|
(_tileOverlayRef$curre = tileOverlayRef.current) === null || _tileOverlayRef$curre === void 0 ? void 0 : _tileOverlayRef$curre.setMap(null);
|
|
1688
1924
|
var option = {
|
|
1689
1925
|
getUrl: getUrl || {
|
|
@@ -1703,6 +1939,7 @@ var MFTileOverlay = function MFTileOverlay(props) {
|
|
|
1703
1939
|
(_tileOverlayRef$curre2 = tileOverlayRef.current) === null || _tileOverlayRef$curre2 === void 0 ? void 0 : _tileOverlayRef$curre2.setMap(theMap);
|
|
1704
1940
|
onCreated && onCreated(tileOverlayRef.current);
|
|
1705
1941
|
};
|
|
1942
|
+
|
|
1706
1943
|
useEffect(function () {
|
|
1707
1944
|
if (theMap && !tileOverlayRef.current) {
|
|
1708
1945
|
reCreate();
|
|
@@ -1711,16 +1948,20 @@ var MFTileOverlay = function MFTileOverlay(props) {
|
|
|
1711
1948
|
useEffect(function () {
|
|
1712
1949
|
if (theMap) {
|
|
1713
1950
|
var _tileOverlayRef$curre3;
|
|
1951
|
+
|
|
1714
1952
|
(_tileOverlayRef$curre3 = tileOverlayRef.current) === null || _tileOverlayRef$curre3 === void 0 ? void 0 : _tileOverlayRef$curre3.setMap(theMap);
|
|
1715
1953
|
}
|
|
1954
|
+
|
|
1716
1955
|
return function () {
|
|
1717
1956
|
var _tileOverlayRef$curre4;
|
|
1957
|
+
|
|
1718
1958
|
(_tileOverlayRef$curre4 = tileOverlayRef.current) === null || _tileOverlayRef$curre4 === void 0 ? void 0 : _tileOverlayRef$curre4.setMap(null);
|
|
1719
1959
|
};
|
|
1720
1960
|
}, [theMap]);
|
|
1721
1961
|
useEffect(function () {
|
|
1722
1962
|
return function () {
|
|
1723
1963
|
var _tileOverlayRef$curre5;
|
|
1964
|
+
|
|
1724
1965
|
(_tileOverlayRef$curre5 = tileOverlayRef.current) === null || _tileOverlayRef$curre5 === void 0 ? void 0 : _tileOverlayRef$curre5.setMap(null);
|
|
1725
1966
|
};
|
|
1726
1967
|
}, []);
|
|
@@ -1731,14 +1972,17 @@ var MFTileOverlay = function MFTileOverlay(props) {
|
|
|
1731
1972
|
}, [getUrl]);
|
|
1732
1973
|
useEffect(function () {
|
|
1733
1974
|
var _tileOverlayRef$curre6;
|
|
1975
|
+
|
|
1734
1976
|
(_tileOverlayRef$curre6 = tileOverlayRef.current) === null || _tileOverlayRef$curre6 === void 0 ? void 0 : _tileOverlayRef$curre6.setVisible(visible);
|
|
1735
1977
|
}, [visible]);
|
|
1736
1978
|
useEffect(function () {
|
|
1737
1979
|
var _tileOverlayRef$curre7;
|
|
1980
|
+
|
|
1738
1981
|
zIndex != undefined && ((_tileOverlayRef$curre7 = tileOverlayRef.current) === null || _tileOverlayRef$curre7 === void 0 ? void 0 : _tileOverlayRef$curre7.setZIndex(zIndex));
|
|
1739
1982
|
}, [zIndex]);
|
|
1740
1983
|
useEffect(function () {
|
|
1741
1984
|
var _tileOverlayRef$curre8;
|
|
1985
|
+
|
|
1742
1986
|
opacity != undefined && ((_tileOverlayRef$curre8 = tileOverlayRef.current) === null || _tileOverlayRef$curre8 === void 0 ? void 0 : _tileOverlayRef$curre8.setOpacity(opacity));
|
|
1743
1987
|
}, [opacity]);
|
|
1744
1988
|
return null;
|
|
@@ -1753,6 +1997,7 @@ function _defineProperties(target, props) {
|
|
|
1753
1997
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1754
1998
|
}
|
|
1755
1999
|
}
|
|
2000
|
+
|
|
1756
2001
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
1757
2002
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1758
2003
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -1761,11 +2006,14 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
1761
2006
|
});
|
|
1762
2007
|
return Constructor;
|
|
1763
2008
|
}
|
|
2009
|
+
|
|
1764
2010
|
function _inheritsLoose(subClass, superClass) {
|
|
1765
2011
|
subClass.prototype = Object.create(superClass.prototype);
|
|
1766
2012
|
subClass.prototype.constructor = subClass;
|
|
2013
|
+
|
|
1767
2014
|
_setPrototypeOf(subClass, superClass);
|
|
1768
2015
|
}
|
|
2016
|
+
|
|
1769
2017
|
function _setPrototypeOf(o, p) {
|
|
1770
2018
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
1771
2019
|
o.__proto__ = p;
|
|
@@ -1779,70 +2027,91 @@ var Vector2 = /*#__PURE__*/function () {
|
|
|
1779
2027
|
if (x === void 0) {
|
|
1780
2028
|
x = 0.0;
|
|
1781
2029
|
}
|
|
2030
|
+
|
|
1782
2031
|
if (y === void 0) {
|
|
1783
2032
|
y = 0.0;
|
|
1784
2033
|
}
|
|
2034
|
+
|
|
1785
2035
|
this.x = x;
|
|
1786
2036
|
this.y = y;
|
|
1787
2037
|
}
|
|
2038
|
+
|
|
1788
2039
|
var _proto = Vector2.prototype;
|
|
2040
|
+
|
|
1789
2041
|
_proto.clone = function clone() {
|
|
1790
2042
|
return new Vector2(this.x, this.y);
|
|
1791
2043
|
};
|
|
2044
|
+
|
|
1792
2045
|
_proto.normalize = function normalize() {
|
|
1793
2046
|
var length = this.length;
|
|
1794
2047
|
var x = 0.0;
|
|
1795
2048
|
var y = 0.0;
|
|
2049
|
+
|
|
1796
2050
|
if (length > 0) {
|
|
1797
2051
|
x = this.x / length;
|
|
1798
2052
|
y = this.y / length;
|
|
1799
2053
|
}
|
|
2054
|
+
|
|
1800
2055
|
return new Vector2(x, y);
|
|
1801
2056
|
};
|
|
2057
|
+
|
|
1802
2058
|
_proto.set = function set(a) {
|
|
1803
2059
|
this.x = a.x;
|
|
1804
2060
|
this.y = a.y;
|
|
1805
2061
|
};
|
|
2062
|
+
|
|
1806
2063
|
_proto.invert = function invert() {
|
|
1807
2064
|
return new Vector2(-this.x, -this.y);
|
|
1808
2065
|
};
|
|
2066
|
+
|
|
1809
2067
|
_proto.rotate90 = function rotate90() {
|
|
1810
2068
|
return new Vector2(this.y, -this.x);
|
|
1811
2069
|
};
|
|
2070
|
+
|
|
1812
2071
|
_proto.add = function add(a) {
|
|
1813
2072
|
return new Vector2(a.x + this.x, a.y + this.y);
|
|
1814
2073
|
};
|
|
2074
|
+
|
|
1815
2075
|
_proto.subtract = function subtract(a) {
|
|
1816
2076
|
if (!a) {
|
|
1817
2077
|
return this.clone();
|
|
1818
2078
|
}
|
|
2079
|
+
|
|
1819
2080
|
return new Vector2(this.x - a.x, this.y - a.y);
|
|
1820
2081
|
};
|
|
2082
|
+
|
|
1821
2083
|
_proto.multiply = function multiply(a) {
|
|
1822
2084
|
return new Vector2(a * this.x, a * this.y);
|
|
1823
2085
|
};
|
|
2086
|
+
|
|
1824
2087
|
_proto.rotateBy = function rotateBy(a) {
|
|
1825
2088
|
var cos = Math.cos(a * Math.PI / 180);
|
|
1826
2089
|
var sin = Math.sin(a * Math.PI / 180);
|
|
1827
2090
|
return new Vector2(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
|
|
1828
2091
|
};
|
|
2092
|
+
|
|
1829
2093
|
_proto.rotateByRadian = function rotateByRadian(a) {
|
|
1830
2094
|
var cos = Math.cos(a);
|
|
1831
2095
|
var sin = Math.sin(a);
|
|
1832
2096
|
return new Vector2(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
|
|
1833
2097
|
};
|
|
2098
|
+
|
|
1834
2099
|
_proto.cross = function cross(a) {
|
|
1835
2100
|
return this.x * a.y - this.y * a.x;
|
|
1836
2101
|
};
|
|
2102
|
+
|
|
1837
2103
|
_proto.dot = function dot(a) {
|
|
1838
2104
|
return a.x * this.x + a.y * this.y;
|
|
1839
2105
|
};
|
|
2106
|
+
|
|
1840
2107
|
Vector2.perp = function perp(v1, v2) {
|
|
1841
2108
|
return new Vector2(v2[1] - v1[1], v1[0] - v2[0]);
|
|
1842
2109
|
};
|
|
2110
|
+
|
|
1843
2111
|
Vector2.neg = function neg(v) {
|
|
1844
2112
|
return new Vector2(-v.x, -v.y);
|
|
1845
2113
|
};
|
|
2114
|
+
|
|
1846
2115
|
_createClass(Vector2, [{
|
|
1847
2116
|
key: "length",
|
|
1848
2117
|
get: function get() {
|
|
@@ -1854,28 +2123,35 @@ var Vector2 = /*#__PURE__*/function () {
|
|
|
1854
2123
|
return this.x * this.x + this.y * this.y;
|
|
1855
2124
|
}
|
|
1856
2125
|
}]);
|
|
2126
|
+
|
|
1857
2127
|
return Vector2;
|
|
1858
2128
|
}();
|
|
1859
2129
|
|
|
1860
2130
|
var MathUtils = /*#__PURE__*/function () {
|
|
1861
2131
|
function MathUtils() {}
|
|
2132
|
+
|
|
1862
2133
|
MathUtils.clamp = function clamp(value, min, max) {
|
|
1863
2134
|
return value < min ? min : value > max ? max : value;
|
|
1864
2135
|
};
|
|
2136
|
+
|
|
1865
2137
|
MathUtils.toRadians = function toRadians(angleDegrees) {
|
|
1866
2138
|
return angleDegrees * Math.PI / 180.0;
|
|
1867
2139
|
};
|
|
2140
|
+
|
|
1868
2141
|
MathUtils.distance = function distance(p1, p2) {
|
|
1869
2142
|
return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
|
|
1870
2143
|
};
|
|
2144
|
+
|
|
1871
2145
|
MathUtils.findNextPowerOf2 = function findNextPowerOf2(n) {
|
|
1872
2146
|
n = n - 1;
|
|
1873
2147
|
var lg = Math.log2(n);
|
|
1874
2148
|
return 1 << lg + 1;
|
|
1875
2149
|
};
|
|
2150
|
+
|
|
1876
2151
|
MathUtils.findPreviousPowerOf2 = function findPreviousPowerOf2(n) {
|
|
1877
2152
|
return 1 << 31 - Math.clz32(n);
|
|
1878
2153
|
};
|
|
2154
|
+
|
|
1879
2155
|
return MathUtils;
|
|
1880
2156
|
}();
|
|
1881
2157
|
|
|
@@ -1884,75 +2160,97 @@ var Vector3 = /*#__PURE__*/function () {
|
|
|
1884
2160
|
if (x === void 0) {
|
|
1885
2161
|
x = 0.0;
|
|
1886
2162
|
}
|
|
2163
|
+
|
|
1887
2164
|
if (y === void 0) {
|
|
1888
2165
|
y = 0.0;
|
|
1889
2166
|
}
|
|
2167
|
+
|
|
1890
2168
|
if (z === void 0) {
|
|
1891
2169
|
z = 0.0;
|
|
1892
2170
|
}
|
|
2171
|
+
|
|
1893
2172
|
this.x = x;
|
|
1894
2173
|
this.y = y;
|
|
1895
2174
|
this.z = z;
|
|
1896
2175
|
}
|
|
2176
|
+
|
|
1897
2177
|
var _proto = Vector3.prototype;
|
|
2178
|
+
|
|
1898
2179
|
_proto.clone = function clone() {
|
|
1899
2180
|
return new Vector3(this.x, this.y, this.z);
|
|
1900
2181
|
};
|
|
2182
|
+
|
|
1901
2183
|
_proto.buffer = function buffer() {
|
|
1902
2184
|
return new Float32Array([this.x, this.y, this.z]);
|
|
1903
2185
|
};
|
|
2186
|
+
|
|
1904
2187
|
_proto.normalize = function normalize() {
|
|
1905
2188
|
var length = this.length;
|
|
1906
2189
|
var x = 0.0;
|
|
1907
2190
|
var y = 0.0;
|
|
1908
2191
|
var z = 0.0;
|
|
2192
|
+
|
|
1909
2193
|
if (length > 0) {
|
|
1910
2194
|
x = this.x / length;
|
|
1911
2195
|
y = this.y / length;
|
|
1912
2196
|
z = this.z / length;
|
|
1913
2197
|
}
|
|
2198
|
+
|
|
1914
2199
|
return new Vector3(x, y, z);
|
|
1915
2200
|
};
|
|
2201
|
+
|
|
1916
2202
|
_proto.set = function set(a) {
|
|
1917
2203
|
this.x = a.x;
|
|
1918
2204
|
this.y = a.y;
|
|
1919
2205
|
this.z = a.z;
|
|
1920
2206
|
};
|
|
2207
|
+
|
|
1921
2208
|
_proto.invert = function invert() {
|
|
1922
2209
|
return new Vector3(-this.x, -this.y, -this.z);
|
|
1923
2210
|
};
|
|
2211
|
+
|
|
1924
2212
|
_proto.rotate90 = function rotate90() {
|
|
1925
2213
|
return new Vector3(this.y, -this.x, this.z);
|
|
1926
2214
|
};
|
|
2215
|
+
|
|
1927
2216
|
_proto.add = function add(a) {
|
|
1928
2217
|
return new Vector3(a.x + this.x, a.y + this.y, a.z + this.z);
|
|
1929
2218
|
};
|
|
2219
|
+
|
|
1930
2220
|
_proto.subtract = function subtract(a) {
|
|
1931
2221
|
if (!a) {
|
|
1932
2222
|
return this.clone();
|
|
1933
2223
|
}
|
|
2224
|
+
|
|
1934
2225
|
return new Vector3(this.x - a.x, this.y - a.y, this.z - a.z);
|
|
1935
2226
|
};
|
|
2227
|
+
|
|
1936
2228
|
_proto.multiply = function multiply(a) {
|
|
1937
2229
|
return new Vector3(a * this.x, a * this.y, a * this.z);
|
|
1938
2230
|
};
|
|
2231
|
+
|
|
1939
2232
|
_proto.rotateBy = function rotateBy(a) {
|
|
1940
2233
|
var cos = Math.cos(a * Math.PI / 180);
|
|
1941
2234
|
var sin = Math.sin(a * Math.PI / 180);
|
|
1942
2235
|
return new Vector3(this.x * cos - this.y * sin, this.x * sin + this.y * cos);
|
|
1943
2236
|
};
|
|
2237
|
+
|
|
1944
2238
|
_proto.cross = function cross(a) {
|
|
1945
2239
|
return new Vector3(this.y * a.z - this.z * a.y, this.z * a.x - this.x * a.z, this.x * a.y - this.y * a.x);
|
|
1946
2240
|
};
|
|
2241
|
+
|
|
1947
2242
|
_proto.dot = function dot(a) {
|
|
1948
2243
|
return a.x * this.x + a.y * this.y + a.z * this.z;
|
|
1949
2244
|
};
|
|
2245
|
+
|
|
1950
2246
|
Vector3.perp = function perp(v1, v2) {
|
|
1951
2247
|
return new Vector3(v2[1] - v1[1], v1[0] - v2[0]);
|
|
1952
2248
|
};
|
|
2249
|
+
|
|
1953
2250
|
Vector3.neg = function neg(v) {
|
|
1954
2251
|
return new Vector3(-v.x, -v.y, -v.z);
|
|
1955
2252
|
};
|
|
2253
|
+
|
|
1956
2254
|
_createClass(Vector3, [{
|
|
1957
2255
|
key: "length",
|
|
1958
2256
|
get: function get() {
|
|
@@ -1964,6 +2262,7 @@ var Vector3 = /*#__PURE__*/function () {
|
|
|
1964
2262
|
return this.x * this.x + this.y * this.y + this.z * this.z;
|
|
1965
2263
|
}
|
|
1966
2264
|
}]);
|
|
2265
|
+
|
|
1967
2266
|
return Vector3;
|
|
1968
2267
|
}();
|
|
1969
2268
|
|
|
@@ -1972,19 +2271,25 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
1972
2271
|
if (data === void 0) {
|
|
1973
2272
|
data = new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
|
|
1974
2273
|
}
|
|
2274
|
+
|
|
1975
2275
|
this.data = data;
|
|
1976
2276
|
}
|
|
2277
|
+
|
|
1977
2278
|
var _proto = Matrix4.prototype;
|
|
2279
|
+
|
|
1978
2280
|
_proto.setIdentity = function setIdentity(x, y, z) {
|
|
1979
2281
|
if (x === void 0) {
|
|
1980
2282
|
x = 1.0;
|
|
1981
2283
|
}
|
|
2284
|
+
|
|
1982
2285
|
if (y === void 0) {
|
|
1983
2286
|
y = 1.0;
|
|
1984
2287
|
}
|
|
2288
|
+
|
|
1985
2289
|
if (z === void 0) {
|
|
1986
2290
|
z = 1.0;
|
|
1987
2291
|
}
|
|
2292
|
+
|
|
1988
2293
|
this.data[0] = x;
|
|
1989
2294
|
this.data[1] = 0;
|
|
1990
2295
|
this.data[2] = 0;
|
|
@@ -2003,6 +2308,7 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2003
2308
|
this.data[15] = 1.0;
|
|
2004
2309
|
return this;
|
|
2005
2310
|
};
|
|
2311
|
+
|
|
2006
2312
|
_proto.copy = function copy(other) {
|
|
2007
2313
|
this.data[0] = other.data[0];
|
|
2008
2314
|
this.data[1] = other.data[1];
|
|
@@ -2022,27 +2328,33 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2022
2328
|
this.data[15] = other.data[15];
|
|
2023
2329
|
return this;
|
|
2024
2330
|
};
|
|
2331
|
+
|
|
2025
2332
|
Matrix4.translate = function translate(x, y, z) {
|
|
2026
2333
|
if (z === void 0) {
|
|
2027
2334
|
z = 0.0;
|
|
2028
2335
|
}
|
|
2336
|
+
|
|
2029
2337
|
return new Matrix4(new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0., 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0]));
|
|
2030
2338
|
};
|
|
2339
|
+
|
|
2031
2340
|
_proto.translate = function translate(x, y, z) {
|
|
2032
2341
|
if (z === void 0) {
|
|
2033
2342
|
z = 0.0;
|
|
2034
2343
|
}
|
|
2344
|
+
|
|
2035
2345
|
this.data[12] += x;
|
|
2036
2346
|
this.data[13] += y;
|
|
2037
2347
|
this.data[14] += z;
|
|
2038
2348
|
return this;
|
|
2039
2349
|
};
|
|
2350
|
+
|
|
2040
2351
|
Matrix4.rotateX = function rotateX(alpha) {
|
|
2041
2352
|
alpha *= Math.PI / 180.0;
|
|
2042
2353
|
var sinA = Math.sin(alpha);
|
|
2043
2354
|
var cosA = Math.cos(alpha);
|
|
2044
2355
|
return new Matrix4(new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, cosA, sinA, 0.0, 0.0, -sinA, cosA, 0.0, 0.0, 0.0, 0.0, 1.0]));
|
|
2045
2356
|
};
|
|
2357
|
+
|
|
2046
2358
|
_proto.setRotationX = function setRotationX(alpha) {
|
|
2047
2359
|
alpha *= Math.PI / 180.0;
|
|
2048
2360
|
var sinA = Math.sin(alpha);
|
|
@@ -2054,6 +2366,7 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2054
2366
|
this.data[10] = cosA;
|
|
2055
2367
|
return this;
|
|
2056
2368
|
};
|
|
2369
|
+
|
|
2057
2370
|
_proto.rotateX = function rotateX(alpha) {
|
|
2058
2371
|
alpha *= Math.PI / 180.0;
|
|
2059
2372
|
var sinA = Math.sin(alpha);
|
|
@@ -2076,12 +2389,14 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2076
2389
|
this.data[14] = r1 * sinA + r2 * cosA;
|
|
2077
2390
|
return this;
|
|
2078
2391
|
};
|
|
2392
|
+
|
|
2079
2393
|
Matrix4.rotateY = function rotateY(alpha) {
|
|
2080
2394
|
alpha *= Math.PI / 180.0;
|
|
2081
2395
|
var sinA = Math.sin(alpha);
|
|
2082
2396
|
var cosA = Math.cos(alpha);
|
|
2083
2397
|
return new Matrix4(new Float32Array([cosA, 0.0, sinA, 0.0, 0.0, 1.0, 0.0, 0.0, -sinA, 0.0, cosA, 0.0, 0.0, 0.0, 0.0, 1.0]));
|
|
2084
2398
|
};
|
|
2399
|
+
|
|
2085
2400
|
_proto.setRotationY = function setRotationY(alpha) {
|
|
2086
2401
|
alpha *= Math.PI / 180.0;
|
|
2087
2402
|
var sinA = Math.sin(alpha);
|
|
@@ -2093,6 +2408,7 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2093
2408
|
this.data[10] = cosA;
|
|
2094
2409
|
return this;
|
|
2095
2410
|
};
|
|
2411
|
+
|
|
2096
2412
|
_proto.rotateY = function rotateY(alpha) {
|
|
2097
2413
|
alpha *= Math.PI / 180.0;
|
|
2098
2414
|
var sinA = Math.sin(alpha);
|
|
@@ -2115,12 +2431,14 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2115
2431
|
this.data[14] = r0 * sinA + r2 * cosA;
|
|
2116
2432
|
return this;
|
|
2117
2433
|
};
|
|
2434
|
+
|
|
2118
2435
|
Matrix4.rotateZ = function rotateZ(alpha) {
|
|
2119
2436
|
alpha *= Math.PI / 180.0;
|
|
2120
2437
|
var sinA = Math.sin(alpha);
|
|
2121
2438
|
var cosA = Math.cos(alpha);
|
|
2122
2439
|
return new Matrix4(new Float32Array([cosA, sinA, 0.0, 0.0, -sinA, cosA, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]));
|
|
2123
2440
|
};
|
|
2441
|
+
|
|
2124
2442
|
_proto.setRotationZ = function setRotationZ(alpha) {
|
|
2125
2443
|
alpha *= Math.PI / 180.0;
|
|
2126
2444
|
var sinA = Math.sin(alpha);
|
|
@@ -2132,6 +2450,7 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2132
2450
|
this.data[5] = cosA;
|
|
2133
2451
|
return this;
|
|
2134
2452
|
};
|
|
2453
|
+
|
|
2135
2454
|
_proto.rotateZ = function rotateZ(alpha) {
|
|
2136
2455
|
alpha *= Math.PI / 180.0;
|
|
2137
2456
|
var sinA = Math.sin(alpha);
|
|
@@ -2154,11 +2473,14 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2154
2473
|
this.data[13] = r0 * sinA + r1 * cosA;
|
|
2155
2474
|
return this;
|
|
2156
2475
|
};
|
|
2476
|
+
|
|
2157
2477
|
_proto.multiply = function multiply(matrix) {
|
|
2158
2478
|
var result = new Matrix4(new Float32Array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]));
|
|
2479
|
+
|
|
2159
2480
|
if (matrix == null) {
|
|
2160
2481
|
return result;
|
|
2161
2482
|
}
|
|
2483
|
+
|
|
2162
2484
|
for (var i = 0; i < 4; ++i) {
|
|
2163
2485
|
for (var j = 0; j < 4; ++j) {
|
|
2164
2486
|
for (var k = 0; k < 4; ++k) {
|
|
@@ -2166,24 +2488,31 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2166
2488
|
}
|
|
2167
2489
|
}
|
|
2168
2490
|
}
|
|
2491
|
+
|
|
2169
2492
|
return result;
|
|
2170
2493
|
};
|
|
2494
|
+
|
|
2171
2495
|
Matrix4.ortho = function ortho(left, right, bottom, top, near, far) {
|
|
2172
2496
|
if (near === void 0) {
|
|
2173
2497
|
near = -100.0;
|
|
2174
2498
|
}
|
|
2499
|
+
|
|
2175
2500
|
if (far === void 0) {
|
|
2176
2501
|
far = 100.0;
|
|
2177
2502
|
}
|
|
2503
|
+
|
|
2178
2504
|
return new Matrix4(new Float32Array([2.0 / (right - left), 0.0, 0.0, 0.0, 0.0, 2.0 / (top - bottom), 0.0, 0.0, 0.0, 0.0, -2.0 / (far - near), 0.0, -(left + right) / (right - left), -(top + bottom) / (top - bottom), -(near + far) / (near - far), 1.0]));
|
|
2179
2505
|
};
|
|
2506
|
+
|
|
2180
2507
|
_proto.setOrtho = function setOrtho(left, right, bottom, top, near, far) {
|
|
2181
2508
|
if (near === void 0) {
|
|
2182
2509
|
near = -100.0;
|
|
2183
2510
|
}
|
|
2511
|
+
|
|
2184
2512
|
if (far === void 0) {
|
|
2185
2513
|
far = 100.0;
|
|
2186
2514
|
}
|
|
2515
|
+
|
|
2187
2516
|
this.data[0] = 2.0 / (right - left);
|
|
2188
2517
|
this.data[1] = 0;
|
|
2189
2518
|
this.data[2] = 0;
|
|
@@ -2202,32 +2531,40 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2202
2531
|
this.data[15] = 1.0;
|
|
2203
2532
|
return this;
|
|
2204
2533
|
};
|
|
2534
|
+
|
|
2205
2535
|
Matrix4.perspective = function perspective(fov, aspect, near, far) {
|
|
2206
2536
|
var y = Math.tan(fov / 2.0) * near;
|
|
2207
2537
|
var x = y * aspect;
|
|
2208
2538
|
return Matrix4.frustum(-x, x, -y, y, near, far);
|
|
2209
2539
|
};
|
|
2540
|
+
|
|
2210
2541
|
_proto.setPerspective = function setPerspective(fov, aspect, near, far) {
|
|
2211
2542
|
var y = Math.tan(fov / 2.0) * near;
|
|
2212
2543
|
var x = y * aspect;
|
|
2213
2544
|
return this.setFrustum(-x, x, -y, y, near, far);
|
|
2214
2545
|
};
|
|
2546
|
+
|
|
2215
2547
|
Matrix4.frustum = function frustum(left, right, bottom, top, near, far) {
|
|
2216
2548
|
if (near === void 0) {
|
|
2217
2549
|
near = -100.0;
|
|
2218
2550
|
}
|
|
2551
|
+
|
|
2219
2552
|
if (far === void 0) {
|
|
2220
2553
|
far = 100.0;
|
|
2221
2554
|
}
|
|
2555
|
+
|
|
2222
2556
|
return new Matrix4(new Float32Array([2 * near / (right - left), 0, 0, 0, 0, 2 * near / (top - bottom), 0, 0, (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, 0, 0, -2 * near * far / (far - near), 0]));
|
|
2223
2557
|
};
|
|
2558
|
+
|
|
2224
2559
|
_proto.setFrustum = function setFrustum(left, right, bottom, top, near, far) {
|
|
2225
2560
|
if (near === void 0) {
|
|
2226
2561
|
near = -100.0;
|
|
2227
2562
|
}
|
|
2563
|
+
|
|
2228
2564
|
if (far === void 0) {
|
|
2229
2565
|
far = 100.0;
|
|
2230
2566
|
}
|
|
2567
|
+
|
|
2231
2568
|
this.data[0] = 2 * near / (right - left);
|
|
2232
2569
|
this.data[1] = 0;
|
|
2233
2570
|
this.data[2] = 0;
|
|
@@ -2245,88 +2582,117 @@ var Matrix4 = /*#__PURE__*/function () {
|
|
|
2245
2582
|
this.data[14] = -2 * near * far / (far - near);
|
|
2246
2583
|
this.data[15] = 0;
|
|
2247
2584
|
};
|
|
2585
|
+
|
|
2248
2586
|
_proto.transform = function transform(vector, w) {
|
|
2249
2587
|
if (w === void 0) {
|
|
2250
2588
|
w = 0.0;
|
|
2251
2589
|
}
|
|
2590
|
+
|
|
2252
2591
|
var x = this.data[0 * 4 + 0] * vector.x + this.data[1 * 4 + 0] * vector.y + this.data[2 * 4 + 0] * vector.z + this.data[3 * 4 + 0] * w;
|
|
2253
2592
|
var y = this.data[0 * 4 + 1] * vector.x + this.data[1 * 4 + 1] * vector.y + this.data[2 * 4 + 1] * vector.z + this.data[3 * 4 + 1] * w;
|
|
2254
2593
|
var z = this.data[0 * 4 + 2] * vector.x + this.data[1 * 4 + 2] * vector.y + this.data[2 * 4 + 2] * vector.z + this.data[3 * 4 + 2] * w;
|
|
2255
2594
|
w = this.data[0 * 4 + 3] * vector.x + this.data[1 * 4 + 3] * vector.y + this.data[2 * 4 + 3] * vector.z + this.data[3 * 4 + 3] * w;
|
|
2595
|
+
|
|
2256
2596
|
if (w == 0) {
|
|
2257
2597
|
w = 1;
|
|
2258
2598
|
}
|
|
2599
|
+
|
|
2259
2600
|
return new Vector3(x / w, y / w, z / w);
|
|
2260
2601
|
};
|
|
2602
|
+
|
|
2261
2603
|
_proto.buffer = function buffer() {
|
|
2262
2604
|
return this.data;
|
|
2263
2605
|
};
|
|
2606
|
+
|
|
2264
2607
|
_proto.inverse = function inverse() {
|
|
2265
2608
|
var rows = 4;
|
|
2266
2609
|
var cols = 4;
|
|
2267
2610
|
var A = this.data.slice();
|
|
2268
2611
|
var B = new Float32Array([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
|
|
2612
|
+
|
|
2269
2613
|
for (var c = 0; c < cols; ++c) {
|
|
2270
2614
|
var r = c;
|
|
2615
|
+
|
|
2271
2616
|
while (r < rows && A[r * 4 + c] == 0) {
|
|
2272
2617
|
++r;
|
|
2273
2618
|
}
|
|
2619
|
+
|
|
2274
2620
|
if (r == rows || A[r * 4 + c] == 0) {
|
|
2275
2621
|
console.log("Cannot calculate inverse, determinant is zero");
|
|
2276
2622
|
return this;
|
|
2277
2623
|
}
|
|
2624
|
+
|
|
2278
2625
|
if (r != c) {
|
|
2279
2626
|
var _Ac = A.slice(c * rows, (c + 1) * rows);
|
|
2627
|
+
|
|
2280
2628
|
var Ar = A.slice(r * rows, (r + 1) * rows);
|
|
2281
2629
|
A.set(Ar, c * rows);
|
|
2282
2630
|
A.set(_Ac, r * rows);
|
|
2631
|
+
|
|
2283
2632
|
var _Bc = B.slice(c * rows, (c + 1) * rows);
|
|
2633
|
+
|
|
2284
2634
|
var Br = B.slice(r * rows, (r + 1) * rows);
|
|
2285
2635
|
B.set(Br, c * rows);
|
|
2286
2636
|
B.set(_Bc, r * rows);
|
|
2287
2637
|
}
|
|
2638
|
+
|
|
2288
2639
|
var Ac = A.slice(c * rows, (c + 1) * rows);
|
|
2289
2640
|
var Bc = B.slice(c * rows, (c + 1) * rows);
|
|
2641
|
+
|
|
2290
2642
|
for (r = 0; r < rows; ++r) {
|
|
2291
2643
|
var _Ar = A.slice(r * rows, (r + 1) * rows);
|
|
2644
|
+
|
|
2292
2645
|
var _Br = B.slice(r * rows, (r + 1) * rows);
|
|
2646
|
+
|
|
2293
2647
|
if (r != c) {
|
|
2294
2648
|
if (_Ar[c] != 0) {
|
|
2295
2649
|
var f = -_Ar[c] / Ac[c];
|
|
2650
|
+
|
|
2296
2651
|
for (var s = c; s < cols; ++s) {
|
|
2297
2652
|
_Ar[s] = _Ar[s] + f * Ac[s];
|
|
2298
2653
|
}
|
|
2654
|
+
|
|
2299
2655
|
A.set(_Ar, r * rows);
|
|
2656
|
+
|
|
2300
2657
|
for (var _s = 0; _s < cols; ++_s) {
|
|
2301
2658
|
_Br[_s] = _Br[_s] + f * Bc[_s];
|
|
2302
2659
|
}
|
|
2660
|
+
|
|
2303
2661
|
B.set(_Br, r * rows);
|
|
2304
2662
|
}
|
|
2305
2663
|
} else {
|
|
2306
2664
|
var _f = Ac[c];
|
|
2665
|
+
|
|
2307
2666
|
if (_f == 0) {
|
|
2308
2667
|
console.log("Cannot calculate inverse, determinant is zero");
|
|
2309
2668
|
return this;
|
|
2310
2669
|
}
|
|
2670
|
+
|
|
2311
2671
|
for (var _s2 = c; _s2 < cols; ++_s2) {
|
|
2312
2672
|
_Ar[_s2] = _Ar[_s2] / _f;
|
|
2313
2673
|
}
|
|
2674
|
+
|
|
2314
2675
|
A.set(_Ar, r * rows);
|
|
2676
|
+
|
|
2315
2677
|
for (var _s3 = 0; _s3 < cols; ++_s3) {
|
|
2316
2678
|
_Br[_s3] = _Br[_s3] / _f;
|
|
2317
2679
|
}
|
|
2680
|
+
|
|
2318
2681
|
B.set(_Br, r * rows);
|
|
2319
2682
|
}
|
|
2320
2683
|
}
|
|
2321
2684
|
}
|
|
2685
|
+
|
|
2322
2686
|
return new Matrix4(B);
|
|
2323
2687
|
};
|
|
2688
|
+
|
|
2324
2689
|
_createClass(Matrix4, [{
|
|
2325
2690
|
key: "position",
|
|
2326
2691
|
get: function get() {
|
|
2327
2692
|
return new Vector3(this.data[12], this.data[13], this.data[14]);
|
|
2328
2693
|
}
|
|
2329
2694
|
}]);
|
|
2695
|
+
|
|
2330
2696
|
return Matrix4;
|
|
2331
2697
|
}();
|
|
2332
2698
|
|
|
@@ -2335,62 +2701,81 @@ var Color = /*#__PURE__*/function () {
|
|
|
2335
2701
|
if (red === void 0) {
|
|
2336
2702
|
red = 0.0;
|
|
2337
2703
|
}
|
|
2704
|
+
|
|
2338
2705
|
if (green === void 0) {
|
|
2339
2706
|
green = 0.0;
|
|
2340
2707
|
}
|
|
2708
|
+
|
|
2341
2709
|
if (blue === void 0) {
|
|
2342
2710
|
blue = 0.0;
|
|
2343
2711
|
}
|
|
2712
|
+
|
|
2344
2713
|
if (alpha === void 0) {
|
|
2345
2714
|
alpha = 1.0;
|
|
2346
2715
|
}
|
|
2716
|
+
|
|
2347
2717
|
this.alpha = alpha;
|
|
2348
2718
|
this._buffer = new Float32Array([red, green, blue]);
|
|
2349
2719
|
}
|
|
2720
|
+
|
|
2350
2721
|
var _proto = Color.prototype;
|
|
2722
|
+
|
|
2351
2723
|
_proto.rgbBuffer = function rgbBuffer() {
|
|
2352
2724
|
return this._buffer;
|
|
2353
2725
|
};
|
|
2726
|
+
|
|
2354
2727
|
_proto.buffer = function buffer() {
|
|
2355
2728
|
return new Float32Array([this.red, this.green, this.blue, this.alpha]);
|
|
2356
2729
|
};
|
|
2730
|
+
|
|
2357
2731
|
Color.fromHex = function fromHex(hexString) {
|
|
2358
2732
|
if (hexString === void 0) {
|
|
2359
2733
|
hexString = "000000";
|
|
2360
2734
|
}
|
|
2735
|
+
|
|
2361
2736
|
if (hexString.length == 4 || hexString.length == 7 || hexString.length == 9) {
|
|
2362
2737
|
hexString = hexString.substring(1, hexString.length);
|
|
2363
2738
|
}
|
|
2739
|
+
|
|
2364
2740
|
if (hexString.length == 3) {
|
|
2365
2741
|
hexString = hexString.split("").map(function (x) {
|
|
2366
2742
|
return x + x;
|
|
2367
2743
|
}).join("");
|
|
2368
2744
|
}
|
|
2745
|
+
|
|
2369
2746
|
var colorCode = parseInt(hexString, 16);
|
|
2747
|
+
|
|
2370
2748
|
if (hexString.length == 6) {
|
|
2371
2749
|
return new Color((colorCode >> 16) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
|
|
2372
2750
|
} else {
|
|
2373
2751
|
return new Color((colorCode >> 24 & 255) / 255, (colorCode >> 16 & 255) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
|
|
2374
2752
|
}
|
|
2375
2753
|
};
|
|
2754
|
+
|
|
2376
2755
|
Color.fromInt = function fromInt(colorCode) {
|
|
2377
2756
|
if (colorCode === void 0) {
|
|
2378
2757
|
colorCode = 0;
|
|
2379
2758
|
}
|
|
2759
|
+
|
|
2380
2760
|
if (colorCode < 0) {
|
|
2381
2761
|
colorCode = 0;
|
|
2382
2762
|
}
|
|
2763
|
+
|
|
2383
2764
|
return new Color((colorCode >> 16 & 255) / 255, (colorCode >> 8 & 255) / 255, (colorCode & 255) / 255);
|
|
2384
2765
|
};
|
|
2766
|
+
|
|
2385
2767
|
Color.fromVec3 = function fromVec3(color) {
|
|
2386
2768
|
return new Color(color.x, color.y, color.z);
|
|
2387
2769
|
};
|
|
2770
|
+
|
|
2388
2771
|
Color.mix = function mix(a, b, factor) {
|
|
2389
2772
|
return new Color(a.red * factor + b.red * (1 - factor), a.green * factor + b.green * (1 - factor), a.blue * factor + b.blue * (1 - factor), a.alpha * factor + b.alpha * (1 - factor));
|
|
2390
2773
|
};
|
|
2774
|
+
|
|
2391
2775
|
Color.isValid = function isValid(colorString) {
|
|
2392
2776
|
return /^#?([0-9A-Fa-f]){6,8}$/i.test(colorString);
|
|
2393
2777
|
};
|
|
2778
|
+
|
|
2394
2779
|
_createClass(Color, [{
|
|
2395
2780
|
key: "red",
|
|
2396
2781
|
get: function get() {
|
|
@@ -2420,14 +2805,17 @@ var Color = /*#__PURE__*/function () {
|
|
|
2420
2805
|
hex = hex.length > 2 ? hex.substr(0, 2) : hex;
|
|
2421
2806
|
return hex;
|
|
2422
2807
|
};
|
|
2808
|
+
|
|
2423
2809
|
return "#" + float2hex(this.red) + float2hex(this.green) + float2hex(this.blue) + float2hex(this.alpha);
|
|
2424
2810
|
}
|
|
2425
2811
|
}]);
|
|
2812
|
+
|
|
2426
2813
|
return Color;
|
|
2427
2814
|
}();
|
|
2428
2815
|
|
|
2429
2816
|
var MapConstants = /*#__PURE__*/function () {
|
|
2430
2817
|
function MapConstants() {}
|
|
2818
|
+
|
|
2431
2819
|
_createClass(MapConstants, null, [{
|
|
2432
2820
|
key: "placeFontSize",
|
|
2433
2821
|
get: function get() {
|
|
@@ -2439,6 +2827,7 @@ var MapConstants = /*#__PURE__*/function () {
|
|
|
2439
2827
|
return 90.0 - CameraConstants.fov * MathConstants.rad2Deg;
|
|
2440
2828
|
}
|
|
2441
2829
|
}]);
|
|
2830
|
+
|
|
2442
2831
|
return MapConstants;
|
|
2443
2832
|
}();
|
|
2444
2833
|
MapConstants.none = -1.0;
|
|
@@ -2522,15 +2911,19 @@ CameraConstants.farPlane = 1000;
|
|
|
2522
2911
|
CameraConstants.height = 15.5;
|
|
2523
2912
|
var ColorConstants = /*#__PURE__*/function () {
|
|
2524
2913
|
function ColorConstants() {}
|
|
2914
|
+
|
|
2525
2915
|
ColorConstants.getSkyColor = function getSkyColor(name) {
|
|
2526
2916
|
return ColorConstants.skyColors[name];
|
|
2527
2917
|
};
|
|
2918
|
+
|
|
2528
2919
|
ColorConstants.getFogColor = function getFogColor(name) {
|
|
2529
2920
|
return ColorConstants.fogColors[name];
|
|
2530
2921
|
};
|
|
2922
|
+
|
|
2531
2923
|
ColorConstants.getLightColor = function getLightColor(name) {
|
|
2532
2924
|
return ColorConstants.lightColors[name];
|
|
2533
2925
|
};
|
|
2926
|
+
|
|
2534
2927
|
return ColorConstants;
|
|
2535
2928
|
}();
|
|
2536
2929
|
ColorConstants.skyColors = {
|
|
@@ -2553,6 +2946,7 @@ ColorConstants.lightColors = {
|
|
|
2553
2946
|
};
|
|
2554
2947
|
|
|
2555
2948
|
var ClassType;
|
|
2949
|
+
|
|
2556
2950
|
(function (ClassType) {
|
|
2557
2951
|
ClassType[ClassType["MARKER"] = 0] = "MARKER";
|
|
2558
2952
|
ClassType[ClassType["CIRCLE"] = 1] = "CIRCLE";
|
|
@@ -2574,52 +2968,67 @@ var ClassType;
|
|
|
2574
2968
|
ClassType[ClassType["TILE_FEATURE"] = 17] = "TILE_FEATURE";
|
|
2575
2969
|
ClassType[ClassType["VECTOR_TILE_FEATURE"] = 18] = "VECTOR_TILE_FEATURE";
|
|
2576
2970
|
})(ClassType || (ClassType = {}));
|
|
2971
|
+
|
|
2577
2972
|
var Map4dObject = /*#__PURE__*/function () {
|
|
2578
2973
|
function Map4dObject(classType) {
|
|
2579
2974
|
this.classType = classType;
|
|
2580
2975
|
}
|
|
2976
|
+
|
|
2581
2977
|
Map4dObject.isClassType = function isClassType(mapObject, classType) {
|
|
2582
2978
|
var mfClassType = (mapObject || {}).classType;
|
|
2583
2979
|
return mfClassType == classType;
|
|
2584
2980
|
};
|
|
2981
|
+
|
|
2585
2982
|
return Map4dObject;
|
|
2586
2983
|
}();
|
|
2587
2984
|
|
|
2588
2985
|
var LatLng = /*#__PURE__*/function (_Map4dObject) {
|
|
2589
2986
|
_inheritsLoose(LatLng, _Map4dObject);
|
|
2987
|
+
|
|
2590
2988
|
function LatLng(lat, lng) {
|
|
2591
2989
|
var _this;
|
|
2990
|
+
|
|
2592
2991
|
_this = _Map4dObject.call(this, ClassType.LATLNG) || this;
|
|
2593
2992
|
_this.lat = lat;
|
|
2594
2993
|
_this.lng = lng;
|
|
2595
2994
|
return _this;
|
|
2596
2995
|
}
|
|
2996
|
+
|
|
2597
2997
|
var _proto = LatLng.prototype;
|
|
2998
|
+
|
|
2598
2999
|
_proto.equals = function equals(other) {
|
|
2599
3000
|
return this.lat == other.lat && this.lng == other.lng;
|
|
2600
3001
|
};
|
|
3002
|
+
|
|
2601
3003
|
_proto.valid = function valid() {
|
|
2602
3004
|
return isFinite(this.lat) && Math.abs(this.lat) <= 90;
|
|
2603
3005
|
};
|
|
3006
|
+
|
|
2604
3007
|
_proto.toString = function toString() {
|
|
2605
3008
|
return "(" + this.lat + ", " + this.lng + ")";
|
|
2606
3009
|
};
|
|
3010
|
+
|
|
2607
3011
|
LatLng.convert = function convert(input) {
|
|
2608
3012
|
if (Map4dObject.isClassType(input, ClassType.LATLNG)) {
|
|
2609
3013
|
return input;
|
|
2610
3014
|
}
|
|
3015
|
+
|
|
2611
3016
|
if (Array.isArray(input) && input.length === 2) {
|
|
2612
3017
|
return new LatLng(Number(input[1]), Number(input[0]));
|
|
2613
3018
|
}
|
|
3019
|
+
|
|
2614
3020
|
if (!Array.isArray(input) && typeof input === "object" && input !== null && "lat" in input && "lng" in input) {
|
|
2615
3021
|
return new LatLng(Number(input.lat), Number(input.lng));
|
|
2616
3022
|
}
|
|
3023
|
+
|
|
2617
3024
|
throw new Error("`ILngLat` argument must be specified as a LngLat instance, an object " + "{lat: <lat>, lng: <lng>}, or an array of [<lng>, <lat>]");
|
|
2618
3025
|
};
|
|
3026
|
+
|
|
2619
3027
|
_proto.distanceTo = function distanceTo(target) {
|
|
2620
3028
|
if (target == null) {
|
|
2621
3029
|
return 0;
|
|
2622
3030
|
}
|
|
3031
|
+
|
|
2623
3032
|
var desc = LatLng.convert(target);
|
|
2624
3033
|
var latStartRadian = MathConstants.deg2Rad * this.lat;
|
|
2625
3034
|
var longStartRadian = MathConstants.deg2Rad * this.lng;
|
|
@@ -2629,6 +3038,7 @@ var LatLng = /*#__PURE__*/function (_Map4dObject) {
|
|
|
2629
3038
|
var v = Math.sin((longDescRadian - longStartRadian) / 2);
|
|
2630
3039
|
return 2.0 * MapConstants.radiusEarthMeters * Math.asin(Math.sqrt(u * u + Math.cos(latStartRadian) * Math.cos(latDescRadian) * v * v));
|
|
2631
3040
|
};
|
|
3041
|
+
|
|
2632
3042
|
_proto.normalize = function normalize() {
|
|
2633
3043
|
var sign = this.lat > 0 ? -1 : 1;
|
|
2634
3044
|
var lat = (this.lat - sign * 90) % 180 + 90 * sign;
|
|
@@ -2636,24 +3046,30 @@ var LatLng = /*#__PURE__*/function (_Map4dObject) {
|
|
|
2636
3046
|
var lng = (this.lng - sign * 180) % 380 + 180 * sign;
|
|
2637
3047
|
return new LatLng(lat, lng);
|
|
2638
3048
|
};
|
|
3049
|
+
|
|
2639
3050
|
_proto.add = function add(a) {
|
|
2640
3051
|
return new LatLng(this.lat + a.lat, this.lng + a.lng).normalize();
|
|
2641
3052
|
};
|
|
3053
|
+
|
|
2642
3054
|
_proto.subtract = function subtract(a) {
|
|
2643
3055
|
if (!a) {
|
|
2644
3056
|
return this;
|
|
2645
3057
|
}
|
|
3058
|
+
|
|
2646
3059
|
return new LatLng(this.lat - a.lat, this.lng - a.lng).normalize();
|
|
2647
3060
|
};
|
|
3061
|
+
|
|
2648
3062
|
return LatLng;
|
|
2649
3063
|
}(Map4dObject);
|
|
2650
3064
|
|
|
2651
3065
|
var ProjectionMercator = /*#__PURE__*/function () {
|
|
2652
3066
|
function ProjectionMercator() {}
|
|
3067
|
+
|
|
2653
3068
|
ProjectionMercator.projectInternal = function projectInternal(latLng, worldSize) {
|
|
2654
3069
|
var latitude = MathUtils.clamp(latLng.lat, MapConstants.minLatitude, MapConstants.maxLatitude);
|
|
2655
3070
|
return new Vector2(MapConstants.maxLongitude + latLng.lng, MapConstants.maxLongitude - MathConstants.rad2Deg * Math.log(Math.tan(Math.PI / 4 + latitude * Math.PI / MapConstants.maxDegrees))).multiply(worldSize / MapConstants.maxDegrees);
|
|
2656
3071
|
};
|
|
3072
|
+
|
|
2657
3073
|
ProjectionMercator.convertToMeterFromLatLng = function convertToMeterFromLatLng(latLng) {
|
|
2658
3074
|
var constrainedLatitude = MathUtils.clamp(latLng.lat, MapConstants.minLatitude, MapConstants.maxLatitude);
|
|
2659
3075
|
var constrainedLongitude = latLng.lng;
|
|
@@ -2663,14 +3079,17 @@ var ProjectionMercator = /*#__PURE__*/function () {
|
|
|
2663
3079
|
var northing = 0.5 * MapConstants.radiusEarthMeters * Math.log((1 + f) / (1 - f));
|
|
2664
3080
|
return new Vector2(easting, northing);
|
|
2665
3081
|
};
|
|
3082
|
+
|
|
2666
3083
|
ProjectionMercator.convertToLatLngFromMeter = function convertToLatLngFromMeter(meters) {
|
|
2667
3084
|
var latitude = (2 * Math.atan(Math.exp(meters.y / MapConstants.radiusEarthMeters)) - Math.PI / 2.0) * MathConstants.rad2Deg;
|
|
2668
3085
|
var longitude = meters.x * MathConstants.rad2Deg / MapConstants.radiusEarthMeters;
|
|
2669
3086
|
return new LatLng(latitude, longitude);
|
|
2670
3087
|
};
|
|
3088
|
+
|
|
2671
3089
|
ProjectionMercator.projectZoom = function projectZoom(latLng, zoom) {
|
|
2672
3090
|
return this.projectInternal(latLng, 1 << zoom);
|
|
2673
3091
|
};
|
|
3092
|
+
|
|
2674
3093
|
return ProjectionMercator;
|
|
2675
3094
|
}();
|
|
2676
3095
|
|
|
@@ -2681,31 +3100,40 @@ var CoordinateTransformer = /*#__PURE__*/function () {
|
|
|
2681
3100
|
return LatLng.convert(coordinate);
|
|
2682
3101
|
});
|
|
2683
3102
|
}
|
|
3103
|
+
|
|
2684
3104
|
var _proto = CoordinateTransformer.prototype;
|
|
3105
|
+
|
|
2685
3106
|
_proto.setCoordinates = function setCoordinates(coordinates) {
|
|
2686
3107
|
this.coordinates = coordinates.map(function (coordinate) {
|
|
2687
3108
|
return LatLng.convert(coordinate);
|
|
2688
3109
|
});
|
|
2689
3110
|
};
|
|
3111
|
+
|
|
2690
3112
|
_proto.addCoordinates = function addCoordinates(coordinates) {
|
|
2691
3113
|
var _this = this;
|
|
3114
|
+
|
|
2692
3115
|
coordinates.forEach(function (coordinate) {
|
|
2693
3116
|
return _this.coordinates.push(LatLng.convert(coordinate));
|
|
2694
3117
|
});
|
|
2695
3118
|
};
|
|
3119
|
+
|
|
2696
3120
|
_proto.rotate = function rotate(degree, anchor) {
|
|
2697
3121
|
if (anchor === void 0) {
|
|
2698
3122
|
anchor = null;
|
|
2699
3123
|
}
|
|
3124
|
+
|
|
2700
3125
|
if (this.coordinates.length <= 1) {
|
|
2701
3126
|
return this.coordinates.slice();
|
|
2702
3127
|
}
|
|
3128
|
+
|
|
2703
3129
|
var center = null;
|
|
3130
|
+
|
|
2704
3131
|
if (anchor != null) {
|
|
2705
3132
|
center = LatLng.convert(center);
|
|
2706
3133
|
} else {
|
|
2707
3134
|
center = this.center;
|
|
2708
3135
|
}
|
|
3136
|
+
|
|
2709
3137
|
var centerInMeters = ProjectionMercator.convertToMeterFromLatLng(center);
|
|
2710
3138
|
var transformedCoordinates = [];
|
|
2711
3139
|
var degreeInRadians = MathUtils.toRadians(degree);
|
|
@@ -2721,20 +3149,25 @@ var CoordinateTransformer = /*#__PURE__*/function () {
|
|
|
2721
3149
|
});
|
|
2722
3150
|
return transformedCoordinates;
|
|
2723
3151
|
};
|
|
3152
|
+
|
|
2724
3153
|
_proto.translate = function translate(target, anchor) {
|
|
2725
3154
|
if (anchor === void 0) {
|
|
2726
3155
|
anchor = null;
|
|
2727
3156
|
}
|
|
3157
|
+
|
|
2728
3158
|
if (this.coordinates.length <= 0) {
|
|
2729
3159
|
return [];
|
|
2730
3160
|
}
|
|
3161
|
+
|
|
2731
3162
|
var newCenter = LatLng.convert(target);
|
|
2732
3163
|
var oldCenter = null;
|
|
3164
|
+
|
|
2733
3165
|
if (anchor != null) {
|
|
2734
3166
|
oldCenter = LatLng.convert(anchor);
|
|
2735
3167
|
} else {
|
|
2736
3168
|
oldCenter = this.center;
|
|
2737
3169
|
}
|
|
3170
|
+
|
|
2738
3171
|
var transformedCoordinates = [];
|
|
2739
3172
|
var translateVectorX = newCenter.lng - oldCenter.lng;
|
|
2740
3173
|
var translateVectorY = newCenter.lat - oldCenter.lat;
|
|
@@ -2743,19 +3176,24 @@ var CoordinateTransformer = /*#__PURE__*/function () {
|
|
|
2743
3176
|
});
|
|
2744
3177
|
return transformedCoordinates;
|
|
2745
3178
|
};
|
|
3179
|
+
|
|
2746
3180
|
_proto.scale = function scale(_scale, anchor) {
|
|
2747
3181
|
if (anchor === void 0) {
|
|
2748
3182
|
anchor = null;
|
|
2749
3183
|
}
|
|
3184
|
+
|
|
2750
3185
|
if (this.coordinates.length <= 1) {
|
|
2751
3186
|
return this.coordinates.slice();
|
|
2752
3187
|
}
|
|
3188
|
+
|
|
2753
3189
|
var center = null;
|
|
3190
|
+
|
|
2754
3191
|
if (anchor != null) {
|
|
2755
3192
|
center = LatLng.convert(anchor);
|
|
2756
3193
|
} else {
|
|
2757
3194
|
center = this.center;
|
|
2758
3195
|
}
|
|
3196
|
+
|
|
2759
3197
|
var centerInMeters = ProjectionMercator.convertToMeterFromLatLng(center);
|
|
2760
3198
|
var transformedCoordinates = [];
|
|
2761
3199
|
this.coordinates.forEach(function (coordinate) {
|
|
@@ -2768,22 +3206,27 @@ var CoordinateTransformer = /*#__PURE__*/function () {
|
|
|
2768
3206
|
});
|
|
2769
3207
|
return transformedCoordinates;
|
|
2770
3208
|
};
|
|
3209
|
+
|
|
2771
3210
|
_createClass(CoordinateTransformer, [{
|
|
2772
3211
|
key: "center",
|
|
2773
3212
|
get: function get() {
|
|
2774
3213
|
if (this.coordinates.length == 0) {
|
|
2775
3214
|
return null;
|
|
2776
3215
|
}
|
|
3216
|
+
|
|
2777
3217
|
var center = new LatLng(0, 0);
|
|
3218
|
+
|
|
2778
3219
|
for (var i = 0; i < this.coordinates.length; ++i) {
|
|
2779
3220
|
center.lat += this.coordinates[i].lat;
|
|
2780
3221
|
center.lng += this.coordinates[i].lng;
|
|
2781
3222
|
}
|
|
3223
|
+
|
|
2782
3224
|
center.lat /= this.coordinates.length;
|
|
2783
3225
|
center.lng /= this.coordinates.length;
|
|
2784
3226
|
return center;
|
|
2785
3227
|
}
|
|
2786
3228
|
}]);
|
|
3229
|
+
|
|
2787
3230
|
return CoordinateTransformer;
|
|
2788
3231
|
}();
|
|
2789
3232
|
|