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