@mint-ui/map 0.6.1-beta-test2 → 0.6.2-beta-test3
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.
|
@@ -31,6 +31,8 @@ export interface MapMarkerWrapperProps extends MarkerOptions {
|
|
|
31
31
|
endAnimationClassName?: string;
|
|
32
32
|
movingAnimation?: MapMarkerMoving;
|
|
33
33
|
disablePointerEvent?: boolean;
|
|
34
|
+
autoFitToViewport?: boolean;
|
|
35
|
+
autoAdjustAnchor?: boolean;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Mint Map 컴포넌트
|
|
@@ -39,4 +41,4 @@ export interface MapMarkerWrapperProps extends MarkerOptions {
|
|
|
39
41
|
*
|
|
40
42
|
* @returns {JSX.Element} JSX
|
|
41
43
|
*/
|
|
42
|
-
export declare function MapMarkerWrapper({ startAnimationClassName, endAnimationClassName, topOnClick, topOnHover, movingAnimation, disablePointerEvent, children, ...options }: PropsWithChildren<MapMarkerWrapperProps>): JSX.Element;
|
|
44
|
+
export declare function MapMarkerWrapper({ startAnimationClassName, endAnimationClassName, autoFitToViewport, autoAdjustAnchor, topOnClick, topOnHover, movingAnimation, disablePointerEvent, children, ...options }: PropsWithChildren<MapMarkerWrapperProps>): JSX.Element;
|
|
@@ -9,13 +9,78 @@ var MintMapProvider = require('../provider/MintMapProvider.js');
|
|
|
9
9
|
var MarkerMovingHook = require('../hooks/MarkerMovingHook.js');
|
|
10
10
|
var MapDrawables = require('../../types/MapDrawables.js');
|
|
11
11
|
|
|
12
|
-
var offsetCalibration = function (mapType, divElement, options) {
|
|
12
|
+
var offsetCalibration = function (mapType, divElement, options, autoFitToViewport, autoAdjustAnchor, mapDivElement) {
|
|
13
13
|
//google 맵의 anchor 보정 (네이버와 같이 왼쪽/위 기준으로 처리)
|
|
14
14
|
if (mapType === 'google') {
|
|
15
|
-
divElement.style.transform = "translate(50%, 100%) translate(
|
|
15
|
+
divElement.style.transform = "translate(50%, 100%) translate(".concat(options.anchor ? options.anchor.x * -1 : '0', "px, ").concat(options.anchor ? options.anchor.y * -1 : '0', "px)");
|
|
16
16
|
} else if (mapType === 'kakao') {
|
|
17
|
-
divElement.style.transform = "translate(
|
|
17
|
+
divElement.style.transform = "translate(".concat(options.anchor ? options.anchor.x * -1 : '0', "px, ").concat(options.anchor ? options.anchor.y * -1 : '0', "px)");
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
if (autoFitToViewport || autoAdjustAnchor) {
|
|
21
|
+
// google 은 마커의 getBoundingClientRect 값을 바로 얻을 수 없어서 next tick 에 처리 (50회 트라이)
|
|
22
|
+
if (mapType === 'google') {
|
|
23
|
+
transformToFitWithNextTick(divElement, mapDivElement, autoAdjustAnchor, 50);
|
|
24
|
+
} else {
|
|
25
|
+
transformToFit(divElement, mapDivElement, autoAdjustAnchor);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var transformToFitWithNextTick = function (divElement, mapDivElement, anchorAdjust, maxTryCount, nextCount) {
|
|
31
|
+
var tryCount = nextCount || 0;
|
|
32
|
+
setTimeout(function () {
|
|
33
|
+
tryCount += 1;
|
|
34
|
+
|
|
35
|
+
if (tryCount > maxTryCount) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var rect = divElement.getBoundingClientRect();
|
|
40
|
+
|
|
41
|
+
if (rect.x === 0 && rect.y === 0 && rect.width === 0 && rect.height === 0) {
|
|
42
|
+
transformToFitWithNextTick(divElement, mapDivElement, anchorAdjust, maxTryCount, tryCount);
|
|
43
|
+
} else {
|
|
44
|
+
transformToFit(divElement, mapDivElement, anchorAdjust);
|
|
45
|
+
}
|
|
46
|
+
}, 20);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var transformToFit = function (divElement, mapDivElement, anchorAdjust) {
|
|
50
|
+
var mapRect = mapDivElement.getBoundingClientRect();
|
|
51
|
+
var rect = divElement.getBoundingClientRect(); // 보정 값 계산
|
|
52
|
+
|
|
53
|
+
var xValue = getMarkersFitPosition(mapRect.x, mapRect.width, rect.x, rect.width);
|
|
54
|
+
var yValue = getMarkersFitPosition(mapRect.y, mapRect.height, rect.y, rect.height);
|
|
55
|
+
|
|
56
|
+
if (xValue !== 0 || yValue !== 0) {
|
|
57
|
+
if (anchorAdjust) {
|
|
58
|
+
var toLeft = xValue < 0;
|
|
59
|
+
var toRight = xValue > 0;
|
|
60
|
+
var toTop = yValue < 0;
|
|
61
|
+
var toBottom = yValue > 0;
|
|
62
|
+
var transX = toLeft ? rect.width * -1 : toRight ? rect.width : 0;
|
|
63
|
+
var transY = toTop ? rect.height * -1 : toBottom ? rect.height : 0;
|
|
64
|
+
divElement.style.transform = divElement.style.transform + " translate(".concat(transX, "px, ").concat(transY, "px)");
|
|
65
|
+
} else {
|
|
66
|
+
divElement.style.transform = divElement.style.transform + " translate(".concat(xValue, "px, ").concat(yValue, "px)");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var getMarkersFitPosition = function (containerPosition, containerSize, markerPosition, markerSize) {
|
|
72
|
+
var delta = markerPosition - containerPosition;
|
|
73
|
+
var mapSize = containerSize;
|
|
74
|
+
var overflowMin = delta < 0;
|
|
75
|
+
var overflowMax = delta + markerSize > mapSize; // 한쪽만 넘어간 경우 처리
|
|
76
|
+
|
|
77
|
+
if (overflowMin && !overflowMax) {
|
|
78
|
+
return delta * -1;
|
|
79
|
+
} else if (!overflowMin && overflowMax) {
|
|
80
|
+
return mapSize - delta - markerSize;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return 0;
|
|
19
84
|
};
|
|
20
85
|
/**
|
|
21
86
|
* Mint Map 컴포넌트
|
|
@@ -29,15 +94,19 @@ var offsetCalibration = function (mapType, divElement, options) {
|
|
|
29
94
|
function MapMarkerWrapper(_a) {
|
|
30
95
|
_a.startAnimationClassName;
|
|
31
96
|
_a.endAnimationClassName;
|
|
32
|
-
var _b = _a.
|
|
33
|
-
|
|
34
|
-
_c = _a.
|
|
35
|
-
|
|
97
|
+
var _b = _a.autoFitToViewport,
|
|
98
|
+
autoFitToViewport = _b === void 0 ? false : _b,
|
|
99
|
+
_c = _a.autoAdjustAnchor,
|
|
100
|
+
autoAdjustAnchor = _c === void 0 ? false : _c,
|
|
101
|
+
_d = _a.topOnClick,
|
|
102
|
+
topOnClick = _d === void 0 ? false : _d,
|
|
103
|
+
_e = _a.topOnHover,
|
|
104
|
+
topOnHover = _e === void 0 ? false : _e,
|
|
36
105
|
movingAnimation = _a.movingAnimation,
|
|
37
|
-
|
|
38
|
-
disablePointerEvent =
|
|
106
|
+
_f = _a.disablePointerEvent,
|
|
107
|
+
disablePointerEvent = _f === void 0 ? false : _f,
|
|
39
108
|
children = _a.children,
|
|
40
|
-
options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
109
|
+
options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "autoFitToViewport", "autoAdjustAnchor", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
41
110
|
|
|
42
111
|
|
|
43
112
|
var controller = MintMapProvider.useMintMapController(); //element
|
|
@@ -47,9 +116,9 @@ function MapMarkerWrapper(_a) {
|
|
|
47
116
|
|
|
48
117
|
var markerRef = React.useRef(); //moving animation
|
|
49
118
|
|
|
50
|
-
var
|
|
51
|
-
movingState =
|
|
52
|
-
setMovingState =
|
|
119
|
+
var _g = React.useState({}),
|
|
120
|
+
movingState = _g[0],
|
|
121
|
+
setMovingState = _g[1];
|
|
53
122
|
|
|
54
123
|
React.useEffect(function () {
|
|
55
124
|
// console.log('movingState', movingState);
|
|
@@ -150,7 +219,7 @@ function MapMarkerWrapper(_a) {
|
|
|
150
219
|
} //marker offset 보정
|
|
151
220
|
|
|
152
221
|
|
|
153
|
-
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
222
|
+
offsetCalibration(controller.getMapType(), divElement, options, autoFitToViewport, autoAdjustAnchor, controller.mapDivElement); //z-index 처리
|
|
154
223
|
|
|
155
224
|
if (options.zIndex !== undefined) {
|
|
156
225
|
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
@@ -167,7 +236,7 @@ function MapMarkerWrapper(_a) {
|
|
|
167
236
|
} //marker offset 보정
|
|
168
237
|
|
|
169
238
|
|
|
170
|
-
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
239
|
+
offsetCalibration(controller.getMapType(), divElement, options, autoFitToViewport, autoAdjustAnchor, controller.mapDivElement); //z-index 처리
|
|
171
240
|
|
|
172
241
|
if (options.zIndex !== undefined) {
|
|
173
242
|
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
package/dist/index.es.js
CHANGED
|
@@ -4171,13 +4171,78 @@ function useMarkerMoving(_a) {
|
|
|
4171
4171
|
return [start, stop, resume];
|
|
4172
4172
|
}
|
|
4173
4173
|
|
|
4174
|
-
var offsetCalibration = function (mapType, divElement, options) {
|
|
4174
|
+
var offsetCalibration = function (mapType, divElement, options, autoFitToViewport, autoAdjustAnchor, mapDivElement) {
|
|
4175
4175
|
//google 맵의 anchor 보정 (네이버와 같이 왼쪽/위 기준으로 처리)
|
|
4176
4176
|
if (mapType === 'google') {
|
|
4177
|
-
divElement.style.transform = "translate(50%, 100%) translate(
|
|
4177
|
+
divElement.style.transform = "translate(50%, 100%) translate(".concat(options.anchor ? options.anchor.x * -1 : '0', "px, ").concat(options.anchor ? options.anchor.y * -1 : '0', "px)");
|
|
4178
4178
|
} else if (mapType === 'kakao') {
|
|
4179
|
-
divElement.style.transform = "translate(
|
|
4179
|
+
divElement.style.transform = "translate(".concat(options.anchor ? options.anchor.x * -1 : '0', "px, ").concat(options.anchor ? options.anchor.y * -1 : '0', "px)");
|
|
4180
4180
|
}
|
|
4181
|
+
|
|
4182
|
+
if (autoFitToViewport || autoAdjustAnchor) {
|
|
4183
|
+
// google 은 마커의 getBoundingClientRect 값을 바로 얻을 수 없어서 next tick 에 처리 (50회 트라이)
|
|
4184
|
+
if (mapType === 'google') {
|
|
4185
|
+
transformToFitWithNextTick(divElement, mapDivElement, autoAdjustAnchor, 50);
|
|
4186
|
+
} else {
|
|
4187
|
+
transformToFit(divElement, mapDivElement, autoAdjustAnchor);
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
};
|
|
4191
|
+
|
|
4192
|
+
var transformToFitWithNextTick = function (divElement, mapDivElement, anchorAdjust, maxTryCount, nextCount) {
|
|
4193
|
+
var tryCount = nextCount || 0;
|
|
4194
|
+
setTimeout(function () {
|
|
4195
|
+
tryCount += 1;
|
|
4196
|
+
|
|
4197
|
+
if (tryCount > maxTryCount) {
|
|
4198
|
+
return;
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4201
|
+
var rect = divElement.getBoundingClientRect();
|
|
4202
|
+
|
|
4203
|
+
if (rect.x === 0 && rect.y === 0 && rect.width === 0 && rect.height === 0) {
|
|
4204
|
+
transformToFitWithNextTick(divElement, mapDivElement, anchorAdjust, maxTryCount, tryCount);
|
|
4205
|
+
} else {
|
|
4206
|
+
transformToFit(divElement, mapDivElement, anchorAdjust);
|
|
4207
|
+
}
|
|
4208
|
+
}, 20);
|
|
4209
|
+
};
|
|
4210
|
+
|
|
4211
|
+
var transformToFit = function (divElement, mapDivElement, anchorAdjust) {
|
|
4212
|
+
var mapRect = mapDivElement.getBoundingClientRect();
|
|
4213
|
+
var rect = divElement.getBoundingClientRect(); // 보정 값 계산
|
|
4214
|
+
|
|
4215
|
+
var xValue = getMarkersFitPosition(mapRect.x, mapRect.width, rect.x, rect.width);
|
|
4216
|
+
var yValue = getMarkersFitPosition(mapRect.y, mapRect.height, rect.y, rect.height);
|
|
4217
|
+
|
|
4218
|
+
if (xValue !== 0 || yValue !== 0) {
|
|
4219
|
+
if (anchorAdjust) {
|
|
4220
|
+
var toLeft = xValue < 0;
|
|
4221
|
+
var toRight = xValue > 0;
|
|
4222
|
+
var toTop = yValue < 0;
|
|
4223
|
+
var toBottom = yValue > 0;
|
|
4224
|
+
var transX = toLeft ? rect.width * -1 : toRight ? rect.width : 0;
|
|
4225
|
+
var transY = toTop ? rect.height * -1 : toBottom ? rect.height : 0;
|
|
4226
|
+
divElement.style.transform = divElement.style.transform + " translate(".concat(transX, "px, ").concat(transY, "px)");
|
|
4227
|
+
} else {
|
|
4228
|
+
divElement.style.transform = divElement.style.transform + " translate(".concat(xValue, "px, ").concat(yValue, "px)");
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
};
|
|
4232
|
+
|
|
4233
|
+
var getMarkersFitPosition = function (containerPosition, containerSize, markerPosition, markerSize) {
|
|
4234
|
+
var delta = markerPosition - containerPosition;
|
|
4235
|
+
var mapSize = containerSize;
|
|
4236
|
+
var overflowMin = delta < 0;
|
|
4237
|
+
var overflowMax = delta + markerSize > mapSize; // 한쪽만 넘어간 경우 처리
|
|
4238
|
+
|
|
4239
|
+
if (overflowMin && !overflowMax) {
|
|
4240
|
+
return delta * -1;
|
|
4241
|
+
} else if (!overflowMin && overflowMax) {
|
|
4242
|
+
return mapSize - delta - markerSize;
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
return 0;
|
|
4181
4246
|
};
|
|
4182
4247
|
/**
|
|
4183
4248
|
* Mint Map 컴포넌트
|
|
@@ -4191,15 +4256,19 @@ var offsetCalibration = function (mapType, divElement, options) {
|
|
|
4191
4256
|
function MapMarkerWrapper(_a) {
|
|
4192
4257
|
_a.startAnimationClassName;
|
|
4193
4258
|
_a.endAnimationClassName;
|
|
4194
|
-
var _b = _a.
|
|
4195
|
-
|
|
4196
|
-
_c = _a.
|
|
4197
|
-
|
|
4259
|
+
var _b = _a.autoFitToViewport,
|
|
4260
|
+
autoFitToViewport = _b === void 0 ? false : _b,
|
|
4261
|
+
_c = _a.autoAdjustAnchor,
|
|
4262
|
+
autoAdjustAnchor = _c === void 0 ? false : _c,
|
|
4263
|
+
_d = _a.topOnClick,
|
|
4264
|
+
topOnClick = _d === void 0 ? false : _d,
|
|
4265
|
+
_e = _a.topOnHover,
|
|
4266
|
+
topOnHover = _e === void 0 ? false : _e,
|
|
4198
4267
|
movingAnimation = _a.movingAnimation,
|
|
4199
|
-
|
|
4200
|
-
disablePointerEvent =
|
|
4268
|
+
_f = _a.disablePointerEvent,
|
|
4269
|
+
disablePointerEvent = _f === void 0 ? false : _f,
|
|
4201
4270
|
children = _a.children,
|
|
4202
|
-
options = __rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
4271
|
+
options = __rest(_a, ["startAnimationClassName", "endAnimationClassName", "autoFitToViewport", "autoAdjustAnchor", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
4203
4272
|
|
|
4204
4273
|
|
|
4205
4274
|
var controller = useMintMapController(); //element
|
|
@@ -4209,9 +4278,9 @@ function MapMarkerWrapper(_a) {
|
|
|
4209
4278
|
|
|
4210
4279
|
var markerRef = useRef(); //moving animation
|
|
4211
4280
|
|
|
4212
|
-
var
|
|
4213
|
-
movingState =
|
|
4214
|
-
setMovingState =
|
|
4281
|
+
var _g = useState({}),
|
|
4282
|
+
movingState = _g[0],
|
|
4283
|
+
setMovingState = _g[1];
|
|
4215
4284
|
|
|
4216
4285
|
useEffect(function () {
|
|
4217
4286
|
// console.log('movingState', movingState);
|
|
@@ -4312,7 +4381,7 @@ function MapMarkerWrapper(_a) {
|
|
|
4312
4381
|
} //marker offset 보정
|
|
4313
4382
|
|
|
4314
4383
|
|
|
4315
|
-
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
4384
|
+
offsetCalibration(controller.getMapType(), divElement, options, autoFitToViewport, autoAdjustAnchor, controller.mapDivElement); //z-index 처리
|
|
4316
4385
|
|
|
4317
4386
|
if (options.zIndex !== undefined) {
|
|
4318
4387
|
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
@@ -4329,7 +4398,7 @@ function MapMarkerWrapper(_a) {
|
|
|
4329
4398
|
} //marker offset 보정
|
|
4330
4399
|
|
|
4331
4400
|
|
|
4332
|
-
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
4401
|
+
offsetCalibration(controller.getMapType(), divElement, options, autoFitToViewport, autoAdjustAnchor, controller.mapDivElement); //z-index 처리
|
|
4333
4402
|
|
|
4334
4403
|
if (options.zIndex !== undefined) {
|
|
4335
4404
|
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
package/dist/index.umd.js
CHANGED
|
@@ -4175,13 +4175,78 @@
|
|
|
4175
4175
|
return [start, stop, resume];
|
|
4176
4176
|
}
|
|
4177
4177
|
|
|
4178
|
-
var offsetCalibration = function (mapType, divElement, options) {
|
|
4178
|
+
var offsetCalibration = function (mapType, divElement, options, autoFitToViewport, autoAdjustAnchor, mapDivElement) {
|
|
4179
4179
|
//google 맵의 anchor 보정 (네이버와 같이 왼쪽/위 기준으로 처리)
|
|
4180
4180
|
if (mapType === 'google') {
|
|
4181
|
-
divElement.style.transform = "translate(50%, 100%) translate(
|
|
4181
|
+
divElement.style.transform = "translate(50%, 100%) translate(".concat(options.anchor ? options.anchor.x * -1 : '0', "px, ").concat(options.anchor ? options.anchor.y * -1 : '0', "px)");
|
|
4182
4182
|
} else if (mapType === 'kakao') {
|
|
4183
|
-
divElement.style.transform = "translate(
|
|
4183
|
+
divElement.style.transform = "translate(".concat(options.anchor ? options.anchor.x * -1 : '0', "px, ").concat(options.anchor ? options.anchor.y * -1 : '0', "px)");
|
|
4184
4184
|
}
|
|
4185
|
+
|
|
4186
|
+
if (autoFitToViewport || autoAdjustAnchor) {
|
|
4187
|
+
// google 은 마커의 getBoundingClientRect 값을 바로 얻을 수 없어서 next tick 에 처리 (50회 트라이)
|
|
4188
|
+
if (mapType === 'google') {
|
|
4189
|
+
transformToFitWithNextTick(divElement, mapDivElement, autoAdjustAnchor, 50);
|
|
4190
|
+
} else {
|
|
4191
|
+
transformToFit(divElement, mapDivElement, autoAdjustAnchor);
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
};
|
|
4195
|
+
|
|
4196
|
+
var transformToFitWithNextTick = function (divElement, mapDivElement, anchorAdjust, maxTryCount, nextCount) {
|
|
4197
|
+
var tryCount = nextCount || 0;
|
|
4198
|
+
setTimeout(function () {
|
|
4199
|
+
tryCount += 1;
|
|
4200
|
+
|
|
4201
|
+
if (tryCount > maxTryCount) {
|
|
4202
|
+
return;
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4205
|
+
var rect = divElement.getBoundingClientRect();
|
|
4206
|
+
|
|
4207
|
+
if (rect.x === 0 && rect.y === 0 && rect.width === 0 && rect.height === 0) {
|
|
4208
|
+
transformToFitWithNextTick(divElement, mapDivElement, anchorAdjust, maxTryCount, tryCount);
|
|
4209
|
+
} else {
|
|
4210
|
+
transformToFit(divElement, mapDivElement, anchorAdjust);
|
|
4211
|
+
}
|
|
4212
|
+
}, 20);
|
|
4213
|
+
};
|
|
4214
|
+
|
|
4215
|
+
var transformToFit = function (divElement, mapDivElement, anchorAdjust) {
|
|
4216
|
+
var mapRect = mapDivElement.getBoundingClientRect();
|
|
4217
|
+
var rect = divElement.getBoundingClientRect(); // 보정 값 계산
|
|
4218
|
+
|
|
4219
|
+
var xValue = getMarkersFitPosition(mapRect.x, mapRect.width, rect.x, rect.width);
|
|
4220
|
+
var yValue = getMarkersFitPosition(mapRect.y, mapRect.height, rect.y, rect.height);
|
|
4221
|
+
|
|
4222
|
+
if (xValue !== 0 || yValue !== 0) {
|
|
4223
|
+
if (anchorAdjust) {
|
|
4224
|
+
var toLeft = xValue < 0;
|
|
4225
|
+
var toRight = xValue > 0;
|
|
4226
|
+
var toTop = yValue < 0;
|
|
4227
|
+
var toBottom = yValue > 0;
|
|
4228
|
+
var transX = toLeft ? rect.width * -1 : toRight ? rect.width : 0;
|
|
4229
|
+
var transY = toTop ? rect.height * -1 : toBottom ? rect.height : 0;
|
|
4230
|
+
divElement.style.transform = divElement.style.transform + " translate(".concat(transX, "px, ").concat(transY, "px)");
|
|
4231
|
+
} else {
|
|
4232
|
+
divElement.style.transform = divElement.style.transform + " translate(".concat(xValue, "px, ").concat(yValue, "px)");
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
};
|
|
4236
|
+
|
|
4237
|
+
var getMarkersFitPosition = function (containerPosition, containerSize, markerPosition, markerSize) {
|
|
4238
|
+
var delta = markerPosition - containerPosition;
|
|
4239
|
+
var mapSize = containerSize;
|
|
4240
|
+
var overflowMin = delta < 0;
|
|
4241
|
+
var overflowMax = delta + markerSize > mapSize; // 한쪽만 넘어간 경우 처리
|
|
4242
|
+
|
|
4243
|
+
if (overflowMin && !overflowMax) {
|
|
4244
|
+
return delta * -1;
|
|
4245
|
+
} else if (!overflowMin && overflowMax) {
|
|
4246
|
+
return mapSize - delta - markerSize;
|
|
4247
|
+
}
|
|
4248
|
+
|
|
4249
|
+
return 0;
|
|
4185
4250
|
};
|
|
4186
4251
|
/**
|
|
4187
4252
|
* Mint Map 컴포넌트
|
|
@@ -4195,15 +4260,19 @@
|
|
|
4195
4260
|
function MapMarkerWrapper(_a) {
|
|
4196
4261
|
_a.startAnimationClassName;
|
|
4197
4262
|
_a.endAnimationClassName;
|
|
4198
|
-
var _b = _a.
|
|
4199
|
-
|
|
4200
|
-
_c = _a.
|
|
4201
|
-
|
|
4263
|
+
var _b = _a.autoFitToViewport,
|
|
4264
|
+
autoFitToViewport = _b === void 0 ? false : _b,
|
|
4265
|
+
_c = _a.autoAdjustAnchor,
|
|
4266
|
+
autoAdjustAnchor = _c === void 0 ? false : _c,
|
|
4267
|
+
_d = _a.topOnClick,
|
|
4268
|
+
topOnClick = _d === void 0 ? false : _d,
|
|
4269
|
+
_e = _a.topOnHover,
|
|
4270
|
+
topOnHover = _e === void 0 ? false : _e,
|
|
4202
4271
|
movingAnimation = _a.movingAnimation,
|
|
4203
|
-
|
|
4204
|
-
disablePointerEvent =
|
|
4272
|
+
_f = _a.disablePointerEvent,
|
|
4273
|
+
disablePointerEvent = _f === void 0 ? false : _f,
|
|
4205
4274
|
children = _a.children,
|
|
4206
|
-
options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
4275
|
+
options = tslib.__rest(_a, ["startAnimationClassName", "endAnimationClassName", "autoFitToViewport", "autoAdjustAnchor", "topOnClick", "topOnHover", "movingAnimation", "disablePointerEvent", "children"]); //controller
|
|
4207
4276
|
|
|
4208
4277
|
|
|
4209
4278
|
var controller = useMintMapController(); //element
|
|
@@ -4213,9 +4282,9 @@
|
|
|
4213
4282
|
|
|
4214
4283
|
var markerRef = React.useRef(); //moving animation
|
|
4215
4284
|
|
|
4216
|
-
var
|
|
4217
|
-
movingState =
|
|
4218
|
-
setMovingState =
|
|
4285
|
+
var _g = React.useState({}),
|
|
4286
|
+
movingState = _g[0],
|
|
4287
|
+
setMovingState = _g[1];
|
|
4219
4288
|
|
|
4220
4289
|
React.useEffect(function () {
|
|
4221
4290
|
// console.log('movingState', movingState);
|
|
@@ -4316,7 +4385,7 @@
|
|
|
4316
4385
|
} //marker offset 보정
|
|
4317
4386
|
|
|
4318
4387
|
|
|
4319
|
-
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
4388
|
+
offsetCalibration(controller.getMapType(), divElement, options, autoFitToViewport, autoAdjustAnchor, controller.mapDivElement); //z-index 처리
|
|
4320
4389
|
|
|
4321
4390
|
if (options.zIndex !== undefined) {
|
|
4322
4391
|
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|
|
@@ -4333,7 +4402,7 @@
|
|
|
4333
4402
|
} //marker offset 보정
|
|
4334
4403
|
|
|
4335
4404
|
|
|
4336
|
-
offsetCalibration(controller.getMapType(), divElement, options); //z-index 처리
|
|
4405
|
+
offsetCalibration(controller.getMapType(), divElement, options, autoFitToViewport, autoAdjustAnchor, controller.mapDivElement); //z-index 처리
|
|
4337
4406
|
|
|
4338
4407
|
if (options.zIndex !== undefined) {
|
|
4339
4408
|
controller.setMarkerZIndex(markerRef.current, options.zIndex);
|