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