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