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