@mint-ui/map 0.5.3-beta → 0.5.4-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/MapBuildingProjection.js +2 -2
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +3 -2
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +39 -52
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +5 -5
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +2 -2
- package/dist/components/mint-map/core/util/{calculate.d.ts → geo.d.ts} +0 -28
- package/dist/components/mint-map/core/util/geo.js +159 -0
- package/dist/components/mint-map/core/util/index.d.ts +2 -1
- package/dist/components/mint-map/core/util/polygon.d.ts +40 -0
- package/dist/components/mint-map/core/util/{calculate.js → polygon.js} +13 -159
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +22 -6
- package/dist/components/mint-map/google/GoogleMintMapController.js +1 -1
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +1 -1
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +2 -1
- package/dist/components/mint-map/naver/NaverMintMapController.js +10 -1
- package/dist/components/mint-map/types/MapDrawables.js +2 -2
- package/dist/components/mint-map/types/MapTypes.js +2 -2
- package/dist/index.es.js +233 -215
- package/dist/index.js +4 -3
- package/dist/index.umd.js +233 -215
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ function MapCanvasWrapper(_a) {
|
|
|
130
130
|
var pos = item.position; // console.log('canvas mouseevent check', pos.offset);
|
|
131
131
|
|
|
132
132
|
if (pos && !pos.offset) {
|
|
133
|
-
pos.offset =
|
|
133
|
+
pos.offset = positionToOffset(pos);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
|
|
@@ -163,7 +163,7 @@ function MapCanvasWrapper(_a) {
|
|
|
163
163
|
|
|
164
164
|
if (map) {
|
|
165
165
|
// const center = controller.getCenter()
|
|
166
|
-
// center.offset =
|
|
166
|
+
// center.offset = positionToOffset(center)
|
|
167
167
|
// if(center.offset){
|
|
168
168
|
// prevX.current = center.offset.x
|
|
169
169
|
// prevY.current = center.offset.y
|
|
@@ -183,7 +183,7 @@ function MapCanvasWrapper(_a) {
|
|
|
183
183
|
|
|
184
184
|
if (containerRef.current) {
|
|
185
185
|
// const pos = controller.getCenter()
|
|
186
|
-
// pos.offset =
|
|
186
|
+
// pos.offset = positionToOffset(pos)
|
|
187
187
|
// const deltaX = prevX.current - pos.offset.x
|
|
188
188
|
// const deltaY = prevY.current - pos.offset.y
|
|
189
189
|
// offsetProvider.current.x += deltaX
|
|
@@ -209,7 +209,7 @@ function MapCanvasWrapper(_a) {
|
|
|
209
209
|
|
|
210
210
|
map.addListener('mousemove', function (e) {
|
|
211
211
|
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
212
|
-
var clickedOffset =
|
|
212
|
+
var clickedOffset = positionToOffset(clickPosition); // console.log('canvas mousemove', clickedOffset);
|
|
213
213
|
|
|
214
214
|
var hitSet = processMouseEvent(clickedOffset, 'onMouseOver'); //mouse out 처리
|
|
215
215
|
|
|
@@ -223,7 +223,7 @@ function MapCanvasWrapper(_a) {
|
|
|
223
223
|
|
|
224
224
|
map.addListener('click', function (e) {
|
|
225
225
|
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
226
|
-
var clickedOffset =
|
|
226
|
+
var clickedOffset = positionToOffset(clickPosition);
|
|
227
227
|
processMouseEvent(clickedOffset, 'onClick');
|
|
228
228
|
});
|
|
229
229
|
}
|
|
@@ -294,7 +294,7 @@ function MapCanvasWrapper(_a) {
|
|
|
294
294
|
if (item.visible === undefined || item.visible) {
|
|
295
295
|
var pos = item.position; //위치 변환
|
|
296
296
|
|
|
297
|
-
pos.offset =
|
|
297
|
+
pos.offset = positionToOffset(pos);
|
|
298
298
|
|
|
299
299
|
if (item.anchor) {
|
|
300
300
|
pos.offset.x += item.anchor.x;
|
|
@@ -323,6 +323,22 @@ function MapCanvasWrapper(_a) {
|
|
|
323
323
|
}, []); //render!!!
|
|
324
324
|
|
|
325
325
|
renderMain();
|
|
326
|
+
|
|
327
|
+
var positionToOffset = React.useCallback(function (position) {
|
|
328
|
+
var div = controller.mapDivElement;
|
|
329
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
330
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
331
|
+
var bounds = controller.getCurrBounds();
|
|
332
|
+
var maxLng = bounds.ne.lng;
|
|
333
|
+
var minLng = bounds.sw.lng;
|
|
334
|
+
var lng = Math.abs(maxLng - minLng);
|
|
335
|
+
var x = w * (position.lng - minLng) / lng;
|
|
336
|
+
var maxLat = bounds.ne.lat;
|
|
337
|
+
var minLat = bounds.sw.lat;
|
|
338
|
+
var lat = Math.abs(maxLat - minLat);
|
|
339
|
+
var y = h * (maxLat - position.lat) / lat;
|
|
340
|
+
return new MapTypes.Offset(x, y);
|
|
341
|
+
}, []);
|
|
326
342
|
return React__default["default"].createElement("div", {
|
|
327
343
|
ref: containerRef,
|
|
328
344
|
style: {
|
|
@@ -460,7 +460,7 @@ function (_super) {
|
|
|
460
460
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
461
461
|
maxZoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.maxZoomLevel,
|
|
462
462
|
minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
|
|
463
|
-
zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
|
|
463
|
+
zoom: ((_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel) || this.getBaseToMapZoom(15),
|
|
464
464
|
disableDefaultUI: true,
|
|
465
465
|
gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
|
|
466
466
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
@@ -452,7 +452,7 @@ function (_super) {
|
|
|
452
452
|
case 2:
|
|
453
453
|
options = {
|
|
454
454
|
center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
|
|
455
|
-
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) ||
|
|
455
|
+
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 15),
|
|
456
456
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
457
457
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
458
458
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
@@ -3,7 +3,7 @@ import { MintMapController } from "../core/MintMapController";
|
|
|
3
3
|
import { ObjectPool } from '@mint-ui/tools';
|
|
4
4
|
import { MapType, MapVendorType } from "../types/CommonTypes";
|
|
5
5
|
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from "../types/MapDrawables";
|
|
6
|
-
import { Bounds, Position } from "../types/MapTypes";
|
|
6
|
+
import { Bounds, Offset, Position } from "../types/MapTypes";
|
|
7
7
|
import { MintMapProps } from "../types/MintMapProps";
|
|
8
8
|
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from "../types/MapEventTypes";
|
|
9
9
|
export declare class NaverMintMapController extends MintMapController {
|
|
@@ -45,6 +45,7 @@ export declare class NaverMintMapController extends MintMapController {
|
|
|
45
45
|
setZoomLevel(zoom: number): void;
|
|
46
46
|
getCenter(): Position;
|
|
47
47
|
setCenter(position: Position): void;
|
|
48
|
+
positionToOffset(position: Position): Offset;
|
|
48
49
|
private eventMap;
|
|
49
50
|
addEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
50
51
|
removeEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
@@ -481,7 +481,7 @@ function (_super) {
|
|
|
481
481
|
case 2:
|
|
482
482
|
options = {
|
|
483
483
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
484
|
-
zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
|
|
484
|
+
zoom: ((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || this.getBaseToMapZoom(15),
|
|
485
485
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
486
486
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
487
487
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
@@ -632,6 +632,15 @@ function (_super) {
|
|
|
632
632
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
+
NaverMintMapController.prototype.positionToOffset = function (position) {
|
|
636
|
+
if (!this.map) {
|
|
637
|
+
return new MapTypes.Offset(0, 0);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
var offset = this.map.getProjection().fromCoordToOffset(new naver.maps.LatLng(position.lat, position.lng));
|
|
641
|
+
return new MapTypes.Offset(offset.x, offset.y);
|
|
642
|
+
};
|
|
643
|
+
|
|
635
644
|
NaverMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
636
645
|
var _this = this;
|
|
637
646
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var
|
|
6
|
+
var polygon = require('../core/util/polygon.js');
|
|
7
7
|
var MapTypes = require('./MapTypes.js');
|
|
8
8
|
|
|
9
9
|
var Drawable =
|
|
@@ -77,7 +77,7 @@ function (_super) {
|
|
|
77
77
|
var paths = this.options.position.map(function (elem) {
|
|
78
78
|
return elem instanceof MapTypes.Position ? elem : new MapTypes.Position(elem[0], elem[1]);
|
|
79
79
|
});
|
|
80
|
-
return
|
|
80
|
+
return polygon.PolygonCalculator.getCenter(paths);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
throw new Error('center 를 찾을 수 없습니다.');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var polygon = require('../core/util/polygon.js');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 좌표값
|
|
@@ -123,7 +123,7 @@ function () {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
Bounds.prototype.intersects = function (positions) {
|
|
126
|
-
return
|
|
126
|
+
return polygon.PolygonCalculator.intersects([this.nw, this.se], positions);
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
return Bounds;
|