@mint-ui/map 0.10.0-beta-test1 → 0.10.0-beta-test2
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/components/mint-map/core/provider/MarkerAutoTransitionProvider.d.ts +4 -1
- package/dist/components/mint-map/core/provider/MarkerAutoTransitionProvider.js +12 -3
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +9 -1
- package/dist/index.es.js +21 -4
- package/dist/index.umd.js +21 -4
- package/package.json +1 -1
|
@@ -8,7 +8,10 @@ export interface MarkerAutoTransitionOption {
|
|
|
8
8
|
}
|
|
9
9
|
export interface MarkerAutoTransitionContextType {
|
|
10
10
|
option: Required<MarkerAutoTransitionOption>;
|
|
11
|
-
transition: (pos: Position) =>
|
|
11
|
+
transition: (pos: Position) => {
|
|
12
|
+
pos: Position;
|
|
13
|
+
no?: number;
|
|
14
|
+
};
|
|
12
15
|
}
|
|
13
16
|
export declare const MarkerAutoTransitionContext: React.Context<MarkerAutoTransitionContextType>;
|
|
14
17
|
export declare const baseCenter: Position;
|
|
@@ -23,7 +23,10 @@ var MarkerAutoTransitionContext = React.createContext({
|
|
|
23
23
|
type: 'diagonal'
|
|
24
24
|
},
|
|
25
25
|
transition: function (pos) {
|
|
26
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
pos: pos,
|
|
28
|
+
no: undefined
|
|
29
|
+
};
|
|
27
30
|
}
|
|
28
31
|
}); // provider
|
|
29
32
|
|
|
@@ -66,14 +69,20 @@ function MarkerAutoTransitionProvider(_a) {
|
|
|
66
69
|
if (count === undefined) {
|
|
67
70
|
count = 1;
|
|
68
71
|
posMap.set(key, count);
|
|
69
|
-
return
|
|
72
|
+
return {
|
|
73
|
+
no: count,
|
|
74
|
+
pos: pos
|
|
75
|
+
};
|
|
70
76
|
} //type : diagonal
|
|
71
77
|
|
|
72
78
|
|
|
73
79
|
var newPos = new MapTypes.Position(pos.lat + count * deltaLat, pos.lng + count * deltaLng);
|
|
74
80
|
count += 1;
|
|
75
81
|
posMap.set(key, count);
|
|
76
|
-
return
|
|
82
|
+
return {
|
|
83
|
+
no: count,
|
|
84
|
+
pos: newPos
|
|
85
|
+
};
|
|
77
86
|
};
|
|
78
87
|
|
|
79
88
|
return React__default["default"].createElement(MarkerAutoTransitionContext.Provider, {
|
|
@@ -216,10 +216,18 @@ function MapMarkerWrapper(_a) {
|
|
|
216
216
|
}, []); //create / update object
|
|
217
217
|
|
|
218
218
|
var transition = React.useContext(MarkerAutoTransitionProvider.MarkerAutoTransitionContext).transition;
|
|
219
|
+
var positionNo = React.useRef();
|
|
219
220
|
React.useEffect(function () {
|
|
220
221
|
if (options) {
|
|
221
222
|
if (!Array.isArray(options.position)) {
|
|
222
|
-
|
|
223
|
+
var _a = transition(options.position),
|
|
224
|
+
no = _a.no,
|
|
225
|
+
pos = _a.pos;
|
|
226
|
+
|
|
227
|
+
if (positionNo.current !== no) {
|
|
228
|
+
options.position = pos;
|
|
229
|
+
positionNo.current = no;
|
|
230
|
+
}
|
|
223
231
|
}
|
|
224
232
|
|
|
225
233
|
if (markerRef.current) {
|
package/dist/index.es.js
CHANGED
|
@@ -4289,7 +4289,10 @@ var MarkerAutoTransitionContext = createContext({
|
|
|
4289
4289
|
type: 'diagonal'
|
|
4290
4290
|
},
|
|
4291
4291
|
transition: function (pos) {
|
|
4292
|
-
return
|
|
4292
|
+
return {
|
|
4293
|
+
pos: pos,
|
|
4294
|
+
no: undefined
|
|
4295
|
+
};
|
|
4293
4296
|
}
|
|
4294
4297
|
}); // provider
|
|
4295
4298
|
|
|
@@ -4332,14 +4335,20 @@ function MarkerAutoTransitionProvider(_a) {
|
|
|
4332
4335
|
if (count === undefined) {
|
|
4333
4336
|
count = 1;
|
|
4334
4337
|
posMap.set(key, count);
|
|
4335
|
-
return
|
|
4338
|
+
return {
|
|
4339
|
+
no: count,
|
|
4340
|
+
pos: pos
|
|
4341
|
+
};
|
|
4336
4342
|
} //type : diagonal
|
|
4337
4343
|
|
|
4338
4344
|
|
|
4339
4345
|
var newPos = new Position(pos.lat + count * deltaLat, pos.lng + count * deltaLng);
|
|
4340
4346
|
count += 1;
|
|
4341
4347
|
posMap.set(key, count);
|
|
4342
|
-
return
|
|
4348
|
+
return {
|
|
4349
|
+
no: count,
|
|
4350
|
+
pos: newPos
|
|
4351
|
+
};
|
|
4343
4352
|
};
|
|
4344
4353
|
|
|
4345
4354
|
return React.createElement(MarkerAutoTransitionContext.Provider, {
|
|
@@ -4563,10 +4572,18 @@ function MapMarkerWrapper(_a) {
|
|
|
4563
4572
|
}, []); //create / update object
|
|
4564
4573
|
|
|
4565
4574
|
var transition = useContext(MarkerAutoTransitionContext).transition;
|
|
4575
|
+
var positionNo = useRef();
|
|
4566
4576
|
useEffect(function () {
|
|
4567
4577
|
if (options) {
|
|
4568
4578
|
if (!Array.isArray(options.position)) {
|
|
4569
|
-
|
|
4579
|
+
var _a = transition(options.position),
|
|
4580
|
+
no = _a.no,
|
|
4581
|
+
pos = _a.pos;
|
|
4582
|
+
|
|
4583
|
+
if (positionNo.current !== no) {
|
|
4584
|
+
options.position = pos;
|
|
4585
|
+
positionNo.current = no;
|
|
4586
|
+
}
|
|
4570
4587
|
}
|
|
4571
4588
|
|
|
4572
4589
|
if (markerRef.current) {
|
package/dist/index.umd.js
CHANGED
|
@@ -4293,7 +4293,10 @@
|
|
|
4293
4293
|
type: 'diagonal'
|
|
4294
4294
|
},
|
|
4295
4295
|
transition: function (pos) {
|
|
4296
|
-
return
|
|
4296
|
+
return {
|
|
4297
|
+
pos: pos,
|
|
4298
|
+
no: undefined
|
|
4299
|
+
};
|
|
4297
4300
|
}
|
|
4298
4301
|
}); // provider
|
|
4299
4302
|
|
|
@@ -4336,14 +4339,20 @@
|
|
|
4336
4339
|
if (count === undefined) {
|
|
4337
4340
|
count = 1;
|
|
4338
4341
|
posMap.set(key, count);
|
|
4339
|
-
return
|
|
4342
|
+
return {
|
|
4343
|
+
no: count,
|
|
4344
|
+
pos: pos
|
|
4345
|
+
};
|
|
4340
4346
|
} //type : diagonal
|
|
4341
4347
|
|
|
4342
4348
|
|
|
4343
4349
|
var newPos = new Position(pos.lat + count * deltaLat, pos.lng + count * deltaLng);
|
|
4344
4350
|
count += 1;
|
|
4345
4351
|
posMap.set(key, count);
|
|
4346
|
-
return
|
|
4352
|
+
return {
|
|
4353
|
+
no: count,
|
|
4354
|
+
pos: newPos
|
|
4355
|
+
};
|
|
4347
4356
|
};
|
|
4348
4357
|
|
|
4349
4358
|
return React__default["default"].createElement(MarkerAutoTransitionContext.Provider, {
|
|
@@ -4567,10 +4576,18 @@
|
|
|
4567
4576
|
}, []); //create / update object
|
|
4568
4577
|
|
|
4569
4578
|
var transition = React.useContext(MarkerAutoTransitionContext).transition;
|
|
4579
|
+
var positionNo = React.useRef();
|
|
4570
4580
|
React.useEffect(function () {
|
|
4571
4581
|
if (options) {
|
|
4572
4582
|
if (!Array.isArray(options.position)) {
|
|
4573
|
-
|
|
4583
|
+
var _a = transition(options.position),
|
|
4584
|
+
no = _a.no,
|
|
4585
|
+
pos = _a.pos;
|
|
4586
|
+
|
|
4587
|
+
if (positionNo.current !== no) {
|
|
4588
|
+
options.position = pos;
|
|
4589
|
+
positionNo.current = no;
|
|
4590
|
+
}
|
|
4574
4591
|
}
|
|
4575
4592
|
|
|
4576
4593
|
if (markerRef.current) {
|