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