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