@mint-ui/map 0.5.10-beta → 0.5.12-beta
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/advanced/shapes/CircleMarker.d.ts +2 -1
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +2 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +2 -1
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +33 -13
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.js +2 -1
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +20 -25
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.js +2 -1
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +2 -2
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +11 -50
- package/dist/components/mint-map/core/wrapper/MintMapWrapper.module.scss.js +2 -2
- package/dist/components/mint-map/types/MapTypes.js +1 -1
- package/dist/index.es.js +149 -172
- package/dist/index.umd.js +149 -172
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
};
|
|
597
597
|
|
|
598
598
|
Bounds.prototype.intersects = function (positions) {
|
|
599
|
-
return PolygonCalculator.intersects([this.nw, this.se], positions);
|
|
599
|
+
return PolygonCalculator.intersects([this.nw, this.sw, this.se, this.ne, this.nw], positions);
|
|
600
600
|
};
|
|
601
601
|
|
|
602
602
|
return Bounds;
|
|
@@ -3729,7 +3729,8 @@
|
|
|
3729
3729
|
pointerEvents: "none",
|
|
3730
3730
|
width: boxSize,
|
|
3731
3731
|
height: boxSize,
|
|
3732
|
-
viewBox: "0 0 ".concat(boxSize, " ").concat(boxSize)
|
|
3732
|
+
viewBox: "0 0 ".concat(boxSize, " ").concat(boxSize),
|
|
3733
|
+
overflow: 'visible'
|
|
3733
3734
|
}, svgProperties), React__default["default"].createElement("circle", tslib.__assign({
|
|
3734
3735
|
pointerEvents: "visiblepainted",
|
|
3735
3736
|
cx: radius,
|
|
@@ -3748,6 +3749,86 @@
|
|
|
3748
3749
|
}, children));
|
|
3749
3750
|
}
|
|
3750
3751
|
|
|
3752
|
+
var Drawable =
|
|
3753
|
+
/** @class */
|
|
3754
|
+
function () {
|
|
3755
|
+
function Drawable() {}
|
|
3756
|
+
|
|
3757
|
+
return Drawable;
|
|
3758
|
+
}();
|
|
3759
|
+
|
|
3760
|
+
var Marker =
|
|
3761
|
+
/** @class */
|
|
3762
|
+
function (_super) {
|
|
3763
|
+
tslib.__extends(Marker, _super);
|
|
3764
|
+
/**
|
|
3765
|
+
* 지도에 표시할 마커정보
|
|
3766
|
+
*/
|
|
3767
|
+
|
|
3768
|
+
|
|
3769
|
+
function Marker(options) {
|
|
3770
|
+
var _this = _super.call(this) || this;
|
|
3771
|
+
|
|
3772
|
+
_this.options = options;
|
|
3773
|
+
return _this;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
return Marker;
|
|
3777
|
+
}(Drawable);
|
|
3778
|
+
|
|
3779
|
+
var Polyline =
|
|
3780
|
+
/** @class */
|
|
3781
|
+
function (_super) {
|
|
3782
|
+
tslib.__extends(Polyline, _super);
|
|
3783
|
+
/**
|
|
3784
|
+
* 지도에 표시할 폴리곤정보
|
|
3785
|
+
*/
|
|
3786
|
+
|
|
3787
|
+
|
|
3788
|
+
function Polyline(options) {
|
|
3789
|
+
var _this = _super.call(this) || this;
|
|
3790
|
+
|
|
3791
|
+
_this.options = options;
|
|
3792
|
+
return _this;
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
return Polyline;
|
|
3796
|
+
}(Drawable);
|
|
3797
|
+
|
|
3798
|
+
var Polygon =
|
|
3799
|
+
/** @class */
|
|
3800
|
+
function (_super) {
|
|
3801
|
+
tslib.__extends(Polygon, _super);
|
|
3802
|
+
/**
|
|
3803
|
+
* 지도에 표시할 폴리곤정보
|
|
3804
|
+
*/
|
|
3805
|
+
|
|
3806
|
+
|
|
3807
|
+
function Polygon(options) {
|
|
3808
|
+
var _this = _super.call(this) || this;
|
|
3809
|
+
|
|
3810
|
+
_this.options = options;
|
|
3811
|
+
return _this;
|
|
3812
|
+
}
|
|
3813
|
+
/**
|
|
3814
|
+
* 폴리곤의 중점을 구한다.
|
|
3815
|
+
*/
|
|
3816
|
+
|
|
3817
|
+
|
|
3818
|
+
Polygon.prototype.getCenter = function () {
|
|
3819
|
+
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
3820
|
+
var paths = this.options.position.map(function (elem) {
|
|
3821
|
+
return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
|
|
3822
|
+
});
|
|
3823
|
+
return PolygonCalculator.getCenter(paths);
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
throw new Error('center 를 찾을 수 없습니다.');
|
|
3827
|
+
};
|
|
3828
|
+
|
|
3829
|
+
return Polygon;
|
|
3830
|
+
}(Drawable);
|
|
3831
|
+
|
|
3751
3832
|
function SVGPolygon(_a) {
|
|
3752
3833
|
var path = _a.path,
|
|
3753
3834
|
_b = _a.innerPath,
|
|
@@ -3802,39 +3883,33 @@
|
|
|
3802
3883
|
containerHeight: height
|
|
3803
3884
|
};
|
|
3804
3885
|
}, []);
|
|
3805
|
-
var getD = React.useCallback(function (
|
|
3806
|
-
var path = _a.path,
|
|
3807
|
-
containerLeft = _a.containerLeft,
|
|
3808
|
-
containerTop = _a.containerTop,
|
|
3809
|
-
mode = _a.mode;
|
|
3810
|
-
var left = containerLeft;
|
|
3811
|
-
var top = containerTop;
|
|
3886
|
+
var getD = React.useCallback(function (path, innerPath, mode) {
|
|
3812
3887
|
var isPolygon = mode === 'POLYGON';
|
|
3813
3888
|
var out = ''; //path
|
|
3814
3889
|
|
|
3815
|
-
out += getLine(path,
|
|
3890
|
+
out += getLine(path, isPolygon); //inner path
|
|
3816
3891
|
|
|
3817
3892
|
for (var _i = 0, innerPath_1 = innerPath; _i < innerPath_1.length; _i++) {
|
|
3818
3893
|
var inner = innerPath_1[_i];
|
|
3819
|
-
out += ' ' + getLine(inner,
|
|
3894
|
+
out += ' ' + getLine(inner, isPolygon);
|
|
3820
3895
|
}
|
|
3821
3896
|
|
|
3822
3897
|
return out;
|
|
3823
3898
|
}, []);
|
|
3824
|
-
var getLine = React.useCallback(function (path,
|
|
3899
|
+
var getLine = React.useCallback(function (path, isPolygon) {
|
|
3825
3900
|
return path.map(function (offset, idx) {
|
|
3826
3901
|
if (idx === 0) {
|
|
3827
|
-
return "M ".concat(offset.x
|
|
3902
|
+
return "M ".concat(offset.x, ",").concat(offset.y);
|
|
3828
3903
|
} else if (idx === 1) {
|
|
3829
|
-
return "L ".concat(offset.x
|
|
3904
|
+
return "L ".concat(offset.x, ",").concat(offset.y);
|
|
3830
3905
|
} else {
|
|
3831
3906
|
if (offset.equals(path[idx - 1])) {
|
|
3832
3907
|
return '';
|
|
3833
3908
|
} else {
|
|
3834
|
-
return "".concat(offset.x
|
|
3909
|
+
return "".concat(offset.x, ",").concat(offset.y);
|
|
3835
3910
|
}
|
|
3836
3911
|
}
|
|
3837
|
-
}).join(' ') + " ".concat(
|
|
3912
|
+
}).join(' ') + " ".concat(isPolygon ? 'Z' : "".concat(path[0].x, ",").concat(path[0].y));
|
|
3838
3913
|
}, []);
|
|
3839
3914
|
|
|
3840
3915
|
var _g = React.useState(0),
|
|
@@ -3849,28 +3924,26 @@
|
|
|
3849
3924
|
d = _j[0],
|
|
3850
3925
|
setD = _j[1];
|
|
3851
3926
|
|
|
3927
|
+
var _k = React.useState(new Offset(0, 0)),
|
|
3928
|
+
polygonAreaInfo = _k[0],
|
|
3929
|
+
setPolygonAreaInfo = _k[1];
|
|
3930
|
+
|
|
3852
3931
|
React.useEffect(function () {
|
|
3853
3932
|
var info = getPolygonInfo(path);
|
|
3933
|
+
setPolygonAreaInfo(new Offset(Math.round(info.containerLeft), Math.round(info.containerTop)));
|
|
3854
3934
|
setWidth(Math.round(info.containerWidth));
|
|
3855
3935
|
setHeight(Math.round(info.containerHeight));
|
|
3856
|
-
setD(getD(
|
|
3857
|
-
|
|
3858
|
-
innerPath: innerPath,
|
|
3859
|
-
mode: mode
|
|
3860
|
-
})));
|
|
3861
|
-
}, [path, innerPath]);
|
|
3936
|
+
setD(getD(path, innerPath, mode));
|
|
3937
|
+
}, [path, innerPath, mode]);
|
|
3862
3938
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("svg", tslib.__assign({
|
|
3863
3939
|
pointerEvents: "none",
|
|
3940
|
+
overflow: 'visible',
|
|
3864
3941
|
width: width,
|
|
3865
3942
|
height: height,
|
|
3866
|
-
viewBox: "
|
|
3943
|
+
viewBox: "".concat(polygonAreaInfo.x, " ").concat(polygonAreaInfo.y, " ").concat(width, " ").concat(height)
|
|
3867
3944
|
}, svgProperties), React__default["default"].createElement("path", tslib.__assign({
|
|
3868
3945
|
fillRule: "evenodd",
|
|
3869
3946
|
pointerEvents: "visiblepainted",
|
|
3870
|
-
x: "0",
|
|
3871
|
-
y: "0",
|
|
3872
|
-
width: width,
|
|
3873
|
-
height: height,
|
|
3874
3947
|
fill: mode === 'POLYLINE' ? 'none' : background,
|
|
3875
3948
|
stroke: mode === 'POLYLINE' ? 'black' : 'green',
|
|
3876
3949
|
strokeLinejoin: "miter",
|
|
@@ -3916,7 +3989,8 @@
|
|
|
3916
3989
|
pointerEvents: "none",
|
|
3917
3990
|
width: width,
|
|
3918
3991
|
height: height,
|
|
3919
|
-
viewBox: "0 0 ".concat(viewWidth.current, " ").concat(viewHeight)
|
|
3992
|
+
viewBox: "0 0 ".concat(viewWidth.current, " ").concat(viewHeight),
|
|
3993
|
+
overflow: 'visible'
|
|
3920
3994
|
}, svgProperties), React__default["default"].createElement("rect", tslib.__assign({
|
|
3921
3995
|
pointerEvents: "visiblepainted",
|
|
3922
3996
|
x: "0",
|
|
@@ -3936,86 +4010,6 @@
|
|
|
3936
4010
|
}, children));
|
|
3937
4011
|
}
|
|
3938
4012
|
|
|
3939
|
-
var Drawable =
|
|
3940
|
-
/** @class */
|
|
3941
|
-
function () {
|
|
3942
|
-
function Drawable() {}
|
|
3943
|
-
|
|
3944
|
-
return Drawable;
|
|
3945
|
-
}();
|
|
3946
|
-
|
|
3947
|
-
var Marker =
|
|
3948
|
-
/** @class */
|
|
3949
|
-
function (_super) {
|
|
3950
|
-
tslib.__extends(Marker, _super);
|
|
3951
|
-
/**
|
|
3952
|
-
* 지도에 표시할 마커정보
|
|
3953
|
-
*/
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
function Marker(options) {
|
|
3957
|
-
var _this = _super.call(this) || this;
|
|
3958
|
-
|
|
3959
|
-
_this.options = options;
|
|
3960
|
-
return _this;
|
|
3961
|
-
}
|
|
3962
|
-
|
|
3963
|
-
return Marker;
|
|
3964
|
-
}(Drawable);
|
|
3965
|
-
|
|
3966
|
-
var Polyline =
|
|
3967
|
-
/** @class */
|
|
3968
|
-
function (_super) {
|
|
3969
|
-
tslib.__extends(Polyline, _super);
|
|
3970
|
-
/**
|
|
3971
|
-
* 지도에 표시할 폴리곤정보
|
|
3972
|
-
*/
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
function Polyline(options) {
|
|
3976
|
-
var _this = _super.call(this) || this;
|
|
3977
|
-
|
|
3978
|
-
_this.options = options;
|
|
3979
|
-
return _this;
|
|
3980
|
-
}
|
|
3981
|
-
|
|
3982
|
-
return Polyline;
|
|
3983
|
-
}(Drawable);
|
|
3984
|
-
|
|
3985
|
-
var Polygon =
|
|
3986
|
-
/** @class */
|
|
3987
|
-
function (_super) {
|
|
3988
|
-
tslib.__extends(Polygon, _super);
|
|
3989
|
-
/**
|
|
3990
|
-
* 지도에 표시할 폴리곤정보
|
|
3991
|
-
*/
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
function Polygon(options) {
|
|
3995
|
-
var _this = _super.call(this) || this;
|
|
3996
|
-
|
|
3997
|
-
_this.options = options;
|
|
3998
|
-
return _this;
|
|
3999
|
-
}
|
|
4000
|
-
/**
|
|
4001
|
-
* 폴리곤의 중점을 구한다.
|
|
4002
|
-
*/
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
Polygon.prototype.getCenter = function () {
|
|
4006
|
-
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
4007
|
-
var paths = this.options.position.map(function (elem) {
|
|
4008
|
-
return elem instanceof Position ? elem : new Position(elem[0], elem[1]);
|
|
4009
|
-
});
|
|
4010
|
-
return PolygonCalculator.getCenter(paths);
|
|
4011
|
-
}
|
|
4012
|
-
|
|
4013
|
-
throw new Error('center 를 찾을 수 없습니다.');
|
|
4014
|
-
};
|
|
4015
|
-
|
|
4016
|
-
return Polygon;
|
|
4017
|
-
}(Drawable);
|
|
4018
|
-
|
|
4019
4013
|
function nextIndex(array, currIdx) {
|
|
4020
4014
|
var next = currIdx + 1;
|
|
4021
4015
|
|
|
@@ -4359,6 +4353,7 @@
|
|
|
4359
4353
|
_f = _a.visible,
|
|
4360
4354
|
visible = _f === void 0 ? true : _f,
|
|
4361
4355
|
zIndex = _a.zIndex,
|
|
4356
|
+
debug = _a.debug,
|
|
4362
4357
|
debugLabel = _a.debugLabel; //controller
|
|
4363
4358
|
|
|
4364
4359
|
var controller = useMintMapController(); //zoom start event
|
|
@@ -4444,6 +4439,7 @@
|
|
|
4444
4439
|
visible: visible,
|
|
4445
4440
|
disablePointerEvent: true,
|
|
4446
4441
|
zIndex: zIndex,
|
|
4442
|
+
debug: debug,
|
|
4447
4443
|
debugLabel: debugLabel
|
|
4448
4444
|
}, mapVisible && React__default["default"].createElement(SVGCircle, {
|
|
4449
4445
|
radius: computedRadius,
|
|
@@ -4483,6 +4479,7 @@
|
|
|
4483
4479
|
zIndex = _a.zIndex,
|
|
4484
4480
|
_h = _a.mode,
|
|
4485
4481
|
mode = _h === void 0 ? 'POLYGON' : _h,
|
|
4482
|
+
debug = _a.debug,
|
|
4486
4483
|
debugLabel = _a.debugLabel; //controller
|
|
4487
4484
|
|
|
4488
4485
|
var controller = useMintMapController(); //zoom start event
|
|
@@ -4496,8 +4493,11 @@
|
|
|
4496
4493
|
|
|
4497
4494
|
if (zoomLevel.current !== newZoomLevel) {
|
|
4498
4495
|
zoomLevel.current = newZoomLevel;
|
|
4499
|
-
|
|
4500
|
-
|
|
4496
|
+
calculatePolygonBase();
|
|
4497
|
+
setTimeout(function () {
|
|
4498
|
+
setMapVisible(true);
|
|
4499
|
+
renderPolygon();
|
|
4500
|
+
}, 50);
|
|
4501
4501
|
}
|
|
4502
4502
|
}, []);
|
|
4503
4503
|
var zoomLevel = React.useRef(controller.getZoomLevel());
|
|
@@ -4534,7 +4534,6 @@
|
|
|
4534
4534
|
}); //polygon 생성 effect
|
|
4535
4535
|
|
|
4536
4536
|
React.useEffect(function () {
|
|
4537
|
-
// console.log('polygon changed');
|
|
4538
4537
|
polygonPropsRef.current = {
|
|
4539
4538
|
position: position,
|
|
4540
4539
|
innerPositions: innerPositions,
|
|
@@ -4542,14 +4541,19 @@
|
|
|
4542
4541
|
simplifyTolerance: simplifyTolerance,
|
|
4543
4542
|
lastReapeated: lastReapeated
|
|
4544
4543
|
};
|
|
4545
|
-
|
|
4544
|
+
calculatePolygonBase(true); // console.log('PolygonMarker useEffect');
|
|
4546
4545
|
}, [position, innerPositions, simplifyPath, simplifyTolerance, lastReapeated]); //render
|
|
4547
4546
|
|
|
4548
4547
|
var _m = React.useState(true),
|
|
4549
4548
|
mapVisible = _m[0],
|
|
4550
4549
|
setMapVisible = _m[1];
|
|
4551
4550
|
|
|
4552
|
-
var
|
|
4551
|
+
var renderInfoRef = React.useRef({
|
|
4552
|
+
offset: [],
|
|
4553
|
+
innerOffset: [],
|
|
4554
|
+
startPosition: undefined
|
|
4555
|
+
});
|
|
4556
|
+
var calculatePolygonBase = React.useCallback(function (renderNow) {
|
|
4553
4557
|
// console.log('renderPolygonBase');
|
|
4554
4558
|
var _a = polygonPropsRef.current,
|
|
4555
4559
|
position = _a.position,
|
|
@@ -4573,7 +4577,7 @@
|
|
|
4573
4577
|
return controller instanceof NaverMintMapController ? controller.naverPositionToOffset(pos) : controller.positionToOffset(pos);
|
|
4574
4578
|
});
|
|
4575
4579
|
var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(offsets, simplifyTolerance, lastReapeated) : offsets;
|
|
4576
|
-
|
|
4580
|
+
renderInfoRef.current.offset = simplified; //inner path
|
|
4577
4581
|
|
|
4578
4582
|
var innerPath = [];
|
|
4579
4583
|
|
|
@@ -4587,27 +4591,39 @@
|
|
|
4587
4591
|
var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(offsets_1, simplifyTolerance, lastReapeated) : offsets_1;
|
|
4588
4592
|
innerPath.push(simplified_1);
|
|
4589
4593
|
}
|
|
4594
|
+
}
|
|
4590
4595
|
|
|
4591
|
-
|
|
4592
|
-
} //start point
|
|
4593
|
-
|
|
4596
|
+
renderInfoRef.current.innerOffset = innerPath; //start point
|
|
4594
4597
|
|
|
4595
4598
|
var startPosition = maxLat && minLng ? new Position(maxLat, minLng) : undefined;
|
|
4596
|
-
|
|
4599
|
+
renderInfoRef.current.startPosition = startPosition;
|
|
4600
|
+
|
|
4601
|
+
if (renderNow) {
|
|
4602
|
+
renderPolygon();
|
|
4603
|
+
}
|
|
4604
|
+
}, []);
|
|
4605
|
+
var renderPolygon = React.useCallback(function () {
|
|
4606
|
+
// console.log('render', renderInfoRef.current.offset);
|
|
4607
|
+
setOffsets(renderInfoRef.current.offset);
|
|
4608
|
+
setInnerOffsets(renderInfoRef.current.innerOffset);
|
|
4609
|
+
setPolygonStart(renderInfoRef.current.startPosition);
|
|
4597
4610
|
}, []);
|
|
4598
4611
|
return React__default["default"].createElement(React__default["default"].Fragment, null, polygonStart && React__default["default"].createElement(MapMarkerWrapper, {
|
|
4599
4612
|
position: polygonStart,
|
|
4600
4613
|
visible: visible,
|
|
4601
4614
|
disablePointerEvent: true,
|
|
4602
4615
|
zIndex: zIndex,
|
|
4616
|
+
debug: debug,
|
|
4603
4617
|
debugLabel: debugLabel
|
|
4604
|
-
},
|
|
4618
|
+
}, React__default["default"].createElement(SVGPolygon, {
|
|
4605
4619
|
path: offsets,
|
|
4606
4620
|
innerPath: innerOffsets,
|
|
4607
4621
|
mode: mode,
|
|
4608
4622
|
background: background,
|
|
4609
4623
|
shapeProperties: shapeProperties,
|
|
4610
|
-
svgProperties:
|
|
4624
|
+
svgProperties: tslib.__assign({
|
|
4625
|
+
display: mapVisible ? '' : 'none'
|
|
4626
|
+
}, svgProperties)
|
|
4611
4627
|
}, children)));
|
|
4612
4628
|
}
|
|
4613
4629
|
|
|
@@ -5057,53 +5073,11 @@
|
|
|
5057
5073
|
}))));
|
|
5058
5074
|
}
|
|
5059
5075
|
|
|
5060
|
-
var css_248z = ".MintMapWrapper-module_mint-map-control-
|
|
5061
|
-
var styles = {"mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
|
|
5076
|
+
var css_248z = ".MintMapWrapper-module_mint-map-control-wrapper-container__DONh7 {\n position: absolute;\n width: 100%;\n height: 100%;\n display: flex;\n pointer-events: none;\n z-index: 101;\n}\n\n.MintMapWrapper-module_mint-map-control-wrapper__DDb4y {\n pointer-events: auto;\n}\n\n.MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV {\n position: absolute;\n z-index: 1;\n}";
|
|
5077
|
+
var styles = {"mint-map-control-wrapper-container":"MintMapWrapper-module_mint-map-control-wrapper-container__DONh7","mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
|
|
5062
5078
|
styleInject__default["default"](css_248z);
|
|
5063
5079
|
|
|
5064
5080
|
var cn = classNames__default["default"].bind(styles);
|
|
5065
|
-
|
|
5066
|
-
var getSizeString = function (size) {
|
|
5067
|
-
return typeof size === 'string' ? size.replace(/ /g, '') : "".concat(size, "px");
|
|
5068
|
-
};
|
|
5069
|
-
|
|
5070
|
-
var getAlignPosition = function (value, align) {
|
|
5071
|
-
if (typeof value === 'string') {
|
|
5072
|
-
var trimmed = value.replace(/ /g, '');
|
|
5073
|
-
console.log('trimmed:', trimmed);
|
|
5074
|
-
var isPercent = trimmed.endsWith('%');
|
|
5075
|
-
|
|
5076
|
-
if (!isPercent && !trimmed.endsWith('px')) {
|
|
5077
|
-
throw new Error("Size [".concat(value, "] is not valid string value."));
|
|
5078
|
-
}
|
|
5079
|
-
|
|
5080
|
-
var numberPart = isPercent ? trimmed.substring(0, trimmed.length - 2) : trimmed.substring(0, trimmed.length - 3);
|
|
5081
|
-
var unit = isPercent ? '%' : 'px';
|
|
5082
|
-
var numberValue = Number(numberPart);
|
|
5083
|
-
|
|
5084
|
-
if (isNaN(numberValue)) {
|
|
5085
|
-
throw new Error("Size [".concat(value, "] is not valid % or pixel number value."));
|
|
5086
|
-
}
|
|
5087
|
-
|
|
5088
|
-
if (align === 'center') {
|
|
5089
|
-
return "calc(50% - ".concat(numberValue / 2).concat(unit, ")");
|
|
5090
|
-
} else if (align === 'right' || align === 'bottom') {
|
|
5091
|
-
return "calc(100% - ".concat(numberValue).concat(unit, ")");
|
|
5092
|
-
} else {
|
|
5093
|
-
return '0px';
|
|
5094
|
-
}
|
|
5095
|
-
} else if (typeof value === 'number') {
|
|
5096
|
-
if (align === 'center') {
|
|
5097
|
-
return "calc(50% - ".concat(value / 2, "px)");
|
|
5098
|
-
} else if (align === 'right' || align === 'bottom') {
|
|
5099
|
-
return "calc(100% - ".concat(value, "px)");
|
|
5100
|
-
} else {
|
|
5101
|
-
return '0px';
|
|
5102
|
-
}
|
|
5103
|
-
}
|
|
5104
|
-
|
|
5105
|
-
throw new Error("Size [".concat(value, "] is not valid. (Should be % or pixel number)"));
|
|
5106
|
-
};
|
|
5107
5081
|
/**
|
|
5108
5082
|
* Mint Map 컴포넌트
|
|
5109
5083
|
*
|
|
@@ -5112,26 +5086,29 @@
|
|
|
5112
5086
|
* @returns {JSX.Element} JSX
|
|
5113
5087
|
*/
|
|
5114
5088
|
|
|
5115
|
-
|
|
5116
5089
|
function MapControlWrapper(_a) {
|
|
5117
5090
|
var _b = _a.width,
|
|
5118
|
-
width = _b === void 0 ?
|
|
5091
|
+
width = _b === void 0 ? 'fit-content' : _b,
|
|
5119
5092
|
_c = _a.height,
|
|
5120
|
-
height = _c === void 0 ?
|
|
5093
|
+
height = _c === void 0 ? 'fit-content' : _c,
|
|
5121
5094
|
_d = _a.positionHorizontal,
|
|
5122
5095
|
positionHorizontal = _d === void 0 ? 'left' : _d,
|
|
5123
5096
|
_e = _a.positionVertical,
|
|
5124
5097
|
positionVertical = _e === void 0 ? 'top' : _e,
|
|
5125
5098
|
children = _a.children;
|
|
5126
5099
|
return React__default["default"].createElement("div", {
|
|
5100
|
+
className: cn('mint-map-control-wrapper-container'),
|
|
5101
|
+
style: {
|
|
5102
|
+
justifyContent: positionHorizontal === 'center' ? 'center' : positionHorizontal === 'right' ? 'flex-end' : 'flex-start',
|
|
5103
|
+
alignItems: positionVertical === 'center' ? 'center' : positionVertical === 'bottom' ? 'flex-end' : 'flex-start'
|
|
5104
|
+
}
|
|
5105
|
+
}, React__default["default"].createElement("div", {
|
|
5127
5106
|
className: cn('mint-map-control-wrapper'),
|
|
5128
5107
|
style: {
|
|
5129
|
-
width:
|
|
5130
|
-
height:
|
|
5131
|
-
left: getAlignPosition(width, positionHorizontal),
|
|
5132
|
-
top: getAlignPosition(height, positionVertical)
|
|
5108
|
+
width: width,
|
|
5109
|
+
height: height
|
|
5133
5110
|
}
|
|
5134
|
-
}, children);
|
|
5111
|
+
}, children));
|
|
5135
5112
|
}
|
|
5136
5113
|
|
|
5137
5114
|
/**
|