@mint-ui/map 0.3.9-beta → 0.4.1-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/README.md +21 -1
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -0
- package/dist/components/mint-map/core/MintMapCanvasRenderer.js +13 -0
- package/dist/components/mint-map/core/MintMapController.d.ts +4 -1
- package/dist/components/mint-map/core/MintMapController.js +33 -0
- package/dist/components/mint-map/core/index.d.ts +1 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +19 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +15 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +4 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +271 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +1 -1
- package/dist/components/mint-map/core/wrapper/index.d.ts +2 -0
- package/dist/components/mint-map/google/GoogleMintMapController.js +1 -0
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +4 -0
- package/dist/components/mint-map/naver/NaverMintMapController.js +1 -0
- package/dist/index.es.js +309 -3
- package/dist/index.js +6 -0
- package/dist/index.umd.js +310 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
- React map library
|
|
4
4
|
- Control various map with one interface
|
|
5
|
-
- Google, Naver map supported now
|
|
5
|
+
- Google, Naver, Kakao map supported now
|
|
6
6
|
- Typescript supported
|
|
7
|
+
- Canvas marker supported (experimental)
|
|
7
8
|
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
@@ -40,6 +41,25 @@ function MyMapComponent(){
|
|
|
40
41
|
<div style={{width:'10px', height:'10px', background:'red', borderRadius:'10px'}}></div>
|
|
41
42
|
|
|
42
43
|
</MapMarkerWrapper>
|
|
44
|
+
|
|
45
|
+
{/* Overlay canvas */}
|
|
46
|
+
<MapCanvasWrapper>
|
|
47
|
+
|
|
48
|
+
{/* Canvas marker */}
|
|
49
|
+
<MapCanvasMarkerWrapper position={new Position(-25.344, 131.031)}
|
|
50
|
+
renderer={(renderer:MintMapCanvasRenderer, offset:Offset, _payload?:TestPayload)=>{
|
|
51
|
+
const {context} = renderer
|
|
52
|
+
context.fillStyle = `hsl(${(Math.random() * 360).toFixed(0)} 100% 60%)`
|
|
53
|
+
context.fillRect(Math.floor(offset.x), Math.floor(offset.y), 8, 8)
|
|
54
|
+
}}
|
|
55
|
+
boxWidth={8} boxHeight={8}
|
|
56
|
+
payload={testItem}
|
|
57
|
+
onClick={(e)=>{
|
|
58
|
+
alert('marker 1 clicked!!!'+e.x+','+e.y)
|
|
59
|
+
}}
|
|
60
|
+
></MapCanvasMarkerWrapper>
|
|
61
|
+
|
|
62
|
+
</MapCanvasWrapper>
|
|
43
63
|
|
|
44
64
|
</MintMap>
|
|
45
65
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var MintMapCanvasRenderer = function () {
|
|
6
|
+
function MintMapCanvasRenderer(context) {
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return MintMapCanvasRenderer;
|
|
11
|
+
}();
|
|
12
|
+
|
|
13
|
+
exports.MintMapCanvasRenderer = MintMapCanvasRenderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bounds, Drawable, MapType, MapVendorType, Marker, MarkerOptions, MintMapProps, Polygon, PolygonOptions, Polyline, PolylineOptions, Position } from "../MintMap";
|
|
1
|
+
import { Bounds, Drawable, MapType, MapVendorType, Marker, MarkerOptions, MintMapProps, Offset, Polygon, PolygonOptions, Polyline, PolylineOptions, Position } from "../MintMap";
|
|
2
2
|
export declare abstract class MintMapController {
|
|
3
3
|
abstract type: MapType;
|
|
4
4
|
abstract map: MapVendorType | null;
|
|
@@ -26,9 +26,12 @@ export declare abstract class MintMapController {
|
|
|
26
26
|
mapProps: MintMapProps;
|
|
27
27
|
mapApiLoaded: boolean;
|
|
28
28
|
mapInitialized: boolean;
|
|
29
|
+
mapDivElement: HTMLDivElement;
|
|
29
30
|
constructor(props: MintMapProps);
|
|
30
31
|
getMap(): MapVendorType | null;
|
|
31
32
|
getMapType(): MapType;
|
|
33
|
+
positionToOffset(position: Position): Offset;
|
|
34
|
+
offsetToPosition(offset: Offset): Position;
|
|
32
35
|
loadScript(url: string, id?: string): Promise<void>;
|
|
33
36
|
buildUrl(baseUrl: string, param: {
|
|
34
37
|
[key: string]: string | string[];
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var MintMap = require('../MintMap.js');
|
|
6
7
|
|
|
7
8
|
var MintMapController = function () {
|
|
8
9
|
function MintMapController(props) {
|
|
@@ -20,6 +21,38 @@ var MintMapController = function () {
|
|
|
20
21
|
return this.type;
|
|
21
22
|
};
|
|
22
23
|
|
|
24
|
+
MintMapController.prototype.positionToOffset = function (position) {
|
|
25
|
+
var div = this.mapDivElement;
|
|
26
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
27
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
28
|
+
var bounds = this.getCurrBounds();
|
|
29
|
+
var maxLng = bounds.ne.lng;
|
|
30
|
+
var minLng = bounds.sw.lng;
|
|
31
|
+
var lng = Math.abs(maxLng - minLng);
|
|
32
|
+
var x = w * (position.lng - minLng) / lng;
|
|
33
|
+
var maxLat = bounds.ne.lat;
|
|
34
|
+
var minLat = bounds.sw.lat;
|
|
35
|
+
var lat = Math.abs(maxLat - minLat);
|
|
36
|
+
var y = h * (maxLat - position.lat) / lat;
|
|
37
|
+
return new MintMap.Offset(x, y);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
41
|
+
var div = this.mapDivElement;
|
|
42
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
43
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
44
|
+
var bounds = this.getCurrBounds();
|
|
45
|
+
var maxLng = bounds.ne.lng;
|
|
46
|
+
var minLng = bounds.sw.lng;
|
|
47
|
+
var lng = Math.abs(maxLng - minLng);
|
|
48
|
+
var lngVal = offset.x * lng / w + minLng;
|
|
49
|
+
var maxLat = bounds.ne.lat;
|
|
50
|
+
var minLat = bounds.sw.lat;
|
|
51
|
+
var lat = Math.abs(maxLat - minLat);
|
|
52
|
+
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
53
|
+
return new MintMap.Position(latVal, lngVal);
|
|
54
|
+
};
|
|
55
|
+
|
|
23
56
|
MintMapController.prototype.loadScript = function (url, id) {
|
|
24
57
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
25
58
|
return tslib.__generator(this, function (_a) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MarkerOptions, Offset } from "../../MintMap";
|
|
3
|
+
import { MintMapCanvasRenderer } from "../MintMapCanvasRenderer";
|
|
4
|
+
export declare type CanvasMarkerRenderer<T> = (ctx: MintMapCanvasRenderer, offset: Offset, payload?: T) => void;
|
|
5
|
+
export interface CanvasMarkerMouseEvent {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
export declare type CanvasMarkerMouseEventCallback = (e: CanvasMarkerMouseEvent) => boolean | undefined | void;
|
|
10
|
+
export interface MapCanvasMarkerWrapperProps<T> extends MarkerOptions {
|
|
11
|
+
renderer: CanvasMarkerRenderer<T>;
|
|
12
|
+
payload?: T;
|
|
13
|
+
boxWidth: number;
|
|
14
|
+
boxHeight: number;
|
|
15
|
+
onClick?: CanvasMarkerMouseEventCallback;
|
|
16
|
+
onMouseOver?: CanvasMarkerMouseEventCallback;
|
|
17
|
+
onMouseOut?: CanvasMarkerMouseEventCallback;
|
|
18
|
+
}
|
|
19
|
+
export declare function MapCanvasMarkerWrapper<T>(_props: MapCanvasMarkerWrapperProps<T>): JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
|
|
11
|
+
function MapCanvasMarkerWrapper(_props) {
|
|
12
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.MapCanvasMarkerWrapper = MapCanvasMarkerWrapper;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var MintMapProvider = require('../provider/MintMapProvider.js');
|
|
8
|
+
var MintMapCanvasRenderer = require('../MintMapCanvasRenderer.js');
|
|
9
|
+
var MintMap = require('../../MintMap.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
|
|
15
|
+
var console = {
|
|
16
|
+
log: function () {
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function MapCanvasWrapper(_a) {
|
|
20
|
+
var children = _a.children;
|
|
21
|
+
tslib.__rest(_a, ["children"]);
|
|
22
|
+
var controller = MintMapProvider.useMintMapController();
|
|
23
|
+
|
|
24
|
+
var _b = React.useState(false),
|
|
25
|
+
renderFlag = _b[0],
|
|
26
|
+
setRenderFlag = _b[1];
|
|
27
|
+
|
|
28
|
+
var invokeRender = React.useCallback(function () {
|
|
29
|
+
setRenderFlag(!renderFlag);
|
|
30
|
+
}, []);
|
|
31
|
+
var renderer = React.useRef();
|
|
32
|
+
var containerRef = React.useRef(null);
|
|
33
|
+
var canvasRef = React.useRef(null);
|
|
34
|
+
var contextRef = React.useRef();
|
|
35
|
+
var clearRect = React.useCallback(function () {
|
|
36
|
+
if (contextRef.current && canvasRef.current) {
|
|
37
|
+
contextRef.current.clearRect(canvasRef.current.width * -1, canvasRef.current.height * -1, canvasRef.current.width * 3, canvasRef.current.height * 3);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return true;
|
|
41
|
+
}, []);
|
|
42
|
+
var scaleCanvas = React.useCallback(function (containerRef, canvasElement, canvasContext) {
|
|
43
|
+
var devicePixelRatio = window.devicePixelRatio;
|
|
44
|
+
var width = containerRef.offsetWidth;
|
|
45
|
+
var height = containerRef.offsetHeight;
|
|
46
|
+
canvasElement.width = width * devicePixelRatio;
|
|
47
|
+
canvasElement.height = height * devicePixelRatio;
|
|
48
|
+
canvasElement.style.width = "".concat(width, "px");
|
|
49
|
+
canvasElement.style.height = "".concat(height, "px");
|
|
50
|
+
canvasContext.scale(devicePixelRatio, devicePixelRatio);
|
|
51
|
+
}, []);
|
|
52
|
+
var parseClickParamToPosition = React.useCallback(function (mapType, e) {
|
|
53
|
+
var latlng = e.latlng || e.latLng;
|
|
54
|
+
|
|
55
|
+
if (!latlng) {
|
|
56
|
+
throw new Error("Map Type ".concat(mapType, " canvas marker click not supported (latlng not found)"));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var clickPosition = new MintMap.Position(0, 0);
|
|
60
|
+
|
|
61
|
+
if (mapType === 'naver') {
|
|
62
|
+
clickPosition.lat = latlng._lat;
|
|
63
|
+
clickPosition.lng = latlng._lng;
|
|
64
|
+
} else if (mapType === 'google') {
|
|
65
|
+
clickPosition.lat = latlng.lat();
|
|
66
|
+
clickPosition.lng = latlng.lng();
|
|
67
|
+
} else if (mapType === 'kakao') {
|
|
68
|
+
clickPosition.lat = latlng.Ma;
|
|
69
|
+
clickPosition.lng = latlng.La;
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error("Map Type ".concat(mapType, " canvas marker click not supported"));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return clickPosition;
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
var includes = function (point, targetPoint, width, height) {
|
|
78
|
+
if (point.x >= targetPoint.x && point.x <= targetPoint.x + width && point.y >= targetPoint.y && point.y <= targetPoint.y + height) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return false;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var processMouseEvent = React.useCallback(function (clickedOffset, eventName) {
|
|
86
|
+
var items = renderItemsOnView.current;
|
|
87
|
+
var hitSet = new Set();
|
|
88
|
+
|
|
89
|
+
for (var i = items.length - 1; i >= 0; i--) {
|
|
90
|
+
var item = items[i];
|
|
91
|
+
|
|
92
|
+
if (item.visible === undefined || item.visible) {
|
|
93
|
+
var event_1 = item[eventName];
|
|
94
|
+
|
|
95
|
+
if (!event_1) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var pos = item.position;
|
|
100
|
+
|
|
101
|
+
if (pos && !pos.offset) {
|
|
102
|
+
pos.offset = controller.positionToOffset(pos);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
event_1(clickedOffset);
|
|
110
|
+
hitSet.add(item);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return hitSet;
|
|
116
|
+
}, []);
|
|
117
|
+
React.useEffect(function () {
|
|
118
|
+
var resizeObserver;
|
|
119
|
+
|
|
120
|
+
if (canvasRef.current && containerRef.current) {
|
|
121
|
+
resizeObserver = new ResizeObserver(function (entries) {
|
|
122
|
+
var elem = entries[0];
|
|
123
|
+
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current);
|
|
124
|
+
renderMain();
|
|
125
|
+
});
|
|
126
|
+
resizeObserver.observe(containerRef.current);
|
|
127
|
+
var map = controller.getMap();
|
|
128
|
+
|
|
129
|
+
if (map) {
|
|
130
|
+
map.addListener('zooming', function () {
|
|
131
|
+
clearRect();
|
|
132
|
+
});
|
|
133
|
+
map.addListener('zoom_start', function () {
|
|
134
|
+
clearRect();
|
|
135
|
+
});
|
|
136
|
+
map.addListener('center_changed', function () {
|
|
137
|
+
|
|
138
|
+
if (containerRef.current) {
|
|
139
|
+
containerRef.current.style.visibility = 'hidden';
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
map.addListener('idle', function () {
|
|
143
|
+
|
|
144
|
+
if (containerRef.current) {
|
|
145
|
+
containerRef.current.style.visibility = '';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
clearRect();
|
|
149
|
+
invokeRender();
|
|
150
|
+
});
|
|
151
|
+
map.addListener('mousemove', function (e) {
|
|
152
|
+
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
153
|
+
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
154
|
+
var hitSet = processMouseEvent(clickedOffset, 'onMouseOver');
|
|
155
|
+
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
156
|
+
if (!hitSet.has(item)) {
|
|
157
|
+
item.onMouseOut && item.onMouseOut(clickedOffset);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
renderItemsMouseOverStatus.current = hitSet;
|
|
161
|
+
});
|
|
162
|
+
map.addListener('click', function (e) {
|
|
163
|
+
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
164
|
+
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
165
|
+
processMouseEvent(clickedOffset, 'onClick');
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
contextRef.current = canvasRef.current.getContext('2d');
|
|
170
|
+
|
|
171
|
+
if (contextRef.current) {
|
|
172
|
+
scaleCanvas(containerRef.current, canvasRef.current, contextRef.current);
|
|
173
|
+
renderer.current = new MintMapCanvasRenderer.MintMapCanvasRenderer(contextRef.current);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return function () {
|
|
178
|
+
resizeObserver && resizeObserver.disconnect();
|
|
179
|
+
};
|
|
180
|
+
}, []);
|
|
181
|
+
var renderItems = React.useRef([]);
|
|
182
|
+
var renderItemsOnView = React.useRef([]);
|
|
183
|
+
var renderItemsMouseOverStatus = React.useRef(new Set());
|
|
184
|
+
React.useEffect(function () {
|
|
185
|
+
renderItems.current = (Array.isArray(children) ? children : [children]).map(function (item) {
|
|
186
|
+
return item.props;
|
|
187
|
+
});
|
|
188
|
+
var zIndexList = [];
|
|
189
|
+
var undefinedList = [];
|
|
190
|
+
|
|
191
|
+
for (var _i = 0, _a = renderItems.current; _i < _a.length; _i++) {
|
|
192
|
+
var item = _a[_i];
|
|
193
|
+
|
|
194
|
+
if (item.zIndex !== undefined) {
|
|
195
|
+
zIndexList.push(item);
|
|
196
|
+
} else {
|
|
197
|
+
undefinedList.push(item);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
renderItems.current = undefinedList;
|
|
202
|
+
zIndexList.sort(function (a, b) {
|
|
203
|
+
return a > b ? 1 : -1;
|
|
204
|
+
}).forEach(function (item) {
|
|
205
|
+
renderItems.current.push(item);
|
|
206
|
+
});
|
|
207
|
+
}, [children]);
|
|
208
|
+
var renderMain = React.useCallback(function () {
|
|
209
|
+
var ctx = contextRef.current;
|
|
210
|
+
var container = containerRef.current;
|
|
211
|
+
|
|
212
|
+
if (!ctx || !container || !renderer.current) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
clearRect();
|
|
217
|
+
var t = new Date().getTime();
|
|
218
|
+
var items = renderItems.current;
|
|
219
|
+
renderItemsOnView.current.length = 0;
|
|
220
|
+
var newSet = new Set();
|
|
221
|
+
|
|
222
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
223
|
+
var item = items_1[_i];
|
|
224
|
+
|
|
225
|
+
if (item.visible === undefined || item.visible) {
|
|
226
|
+
var pos = item.position;
|
|
227
|
+
pos.offset = controller.positionToOffset(pos);
|
|
228
|
+
|
|
229
|
+
if (item.anchor) {
|
|
230
|
+
pos.offset.x += item.anchor.x;
|
|
231
|
+
pos.offset.y += item.anchor.y;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
console.log('canvas marker', pos.offset);
|
|
235
|
+
|
|
236
|
+
if (pos.offset.x < 0 || pos.offset.x > container.offsetWidth || pos.offset.y < 0 || pos.offset.y > container.offsetHeight) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
item.renderer(renderer.current, pos.offset, item.payload);
|
|
241
|
+
renderItemsOnView.current.push(item);
|
|
242
|
+
newSet.add(item);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
247
|
+
if (!newSet.has(item)) {
|
|
248
|
+
renderItemsMouseOverStatus.current.delete(item);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
console.log("[render ends] ".concat(new Date().getTime() - t, " ms"));
|
|
252
|
+
}, []);
|
|
253
|
+
renderMain();
|
|
254
|
+
return React__default["default"].createElement("div", {
|
|
255
|
+
ref: containerRef,
|
|
256
|
+
style: {
|
|
257
|
+
position: 'absolute',
|
|
258
|
+
width: '100%',
|
|
259
|
+
height: '100%',
|
|
260
|
+
zIndex: 2,
|
|
261
|
+
pointerEvents: 'none'
|
|
262
|
+
}
|
|
263
|
+
}, React__default["default"].createElement("canvas", {
|
|
264
|
+
ref: canvasRef,
|
|
265
|
+
style: {
|
|
266
|
+
pointerEvents: 'revert-layer'
|
|
267
|
+
}
|
|
268
|
+
}), renderFlag && React__default["default"].createElement(React__default["default"].Fragment, null));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
exports.MapCanvasWrapper = MapCanvasWrapper;
|
|
@@ -13,7 +13,7 @@ var offsetCalibration = function (mapType, divElement, options) {
|
|
|
13
13
|
if (mapType === 'google') {
|
|
14
14
|
divElement.style.transform = "translate(50%, 100%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
15
15
|
} else if (mapType === 'kakao') {
|
|
16
|
-
divElement.style.transform = "translate(
|
|
16
|
+
divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -372,6 +372,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
372
372
|
var _this = this;
|
|
373
373
|
|
|
374
374
|
return tslib.__generator(this, function (_a) {
|
|
375
|
+
this.mapDivElement = divElement;
|
|
375
376
|
return [2, new Promise(function (resolve) {
|
|
376
377
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
377
378
|
var map;
|
|
@@ -192,6 +192,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
192
192
|
} else {
|
|
193
193
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
194
194
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
195
|
+
marker.element.parentElement.style.margin = '0';
|
|
195
196
|
marker.native = kakaoMarker_1;
|
|
196
197
|
}
|
|
197
198
|
|
|
@@ -215,6 +216,8 @@ var KakaoMintMapController = function (_super) {
|
|
|
215
216
|
if (options.visible !== undefined) {
|
|
216
217
|
marker.native.setVisible(options.visible);
|
|
217
218
|
}
|
|
219
|
+
|
|
220
|
+
marker.element.parentElement.style.margin = '0';
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
};
|
|
@@ -353,6 +356,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
353
356
|
var _this = this;
|
|
354
357
|
|
|
355
358
|
return tslib.__generator(this, function (_a) {
|
|
359
|
+
this.mapDivElement = divElement;
|
|
356
360
|
return [2, new Promise(function (resolve) {
|
|
357
361
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
358
362
|
var options, maxZoom, minZoom, map;
|
|
@@ -362,6 +362,7 @@ var NaverMintMapController = function (_super) {
|
|
|
362
362
|
var _this = this;
|
|
363
363
|
|
|
364
364
|
return tslib.__generator(this, function (_a) {
|
|
365
|
+
this.mapDivElement = divElement;
|
|
365
366
|
return [2, new Promise(function (resolve) {
|
|
366
367
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
367
368
|
var options, maxZoom, minZoom, map;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __generator, __extends, __assign, __rest, __spreadArray } from 'tslib';
|
|
2
|
-
import React, { createContext, useContext, useRef, useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import React, { createContext, useContext, useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
3
3
|
import classNames from 'classnames/bind';
|
|
4
4
|
import styleInject from 'style-inject';
|
|
5
5
|
import { ObjectPool } from '@mint-ui/tools';
|
|
@@ -341,6 +341,38 @@ var MintMapController = function () {
|
|
|
341
341
|
return this.type;
|
|
342
342
|
};
|
|
343
343
|
|
|
344
|
+
MintMapController.prototype.positionToOffset = function (position) {
|
|
345
|
+
var div = this.mapDivElement;
|
|
346
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
347
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
348
|
+
var bounds = this.getCurrBounds();
|
|
349
|
+
var maxLng = bounds.ne.lng;
|
|
350
|
+
var minLng = bounds.sw.lng;
|
|
351
|
+
var lng = Math.abs(maxLng - minLng);
|
|
352
|
+
var x = w * (position.lng - minLng) / lng;
|
|
353
|
+
var maxLat = bounds.ne.lat;
|
|
354
|
+
var minLat = bounds.sw.lat;
|
|
355
|
+
var lat = Math.abs(maxLat - minLat);
|
|
356
|
+
var y = h * (maxLat - position.lat) / lat;
|
|
357
|
+
return new Offset(x, y);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
361
|
+
var div = this.mapDivElement;
|
|
362
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
363
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
364
|
+
var bounds = this.getCurrBounds();
|
|
365
|
+
var maxLng = bounds.ne.lng;
|
|
366
|
+
var minLng = bounds.sw.lng;
|
|
367
|
+
var lng = Math.abs(maxLng - minLng);
|
|
368
|
+
var lngVal = offset.x * lng / w + minLng;
|
|
369
|
+
var maxLat = bounds.ne.lat;
|
|
370
|
+
var minLat = bounds.sw.lat;
|
|
371
|
+
var lat = Math.abs(maxLat - minLat);
|
|
372
|
+
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
373
|
+
return new Position(latVal, lngVal);
|
|
374
|
+
};
|
|
375
|
+
|
|
344
376
|
MintMapController.prototype.loadScript = function (url, id) {
|
|
345
377
|
return __awaiter(this, void 0, void 0, function () {
|
|
346
378
|
return __generator(this, function (_a) {
|
|
@@ -985,6 +1017,7 @@ var NaverMintMapController = function (_super) {
|
|
|
985
1017
|
var _this = this;
|
|
986
1018
|
|
|
987
1019
|
return __generator(this, function (_a) {
|
|
1020
|
+
this.mapDivElement = divElement;
|
|
988
1021
|
return [2, new Promise(function (resolve) {
|
|
989
1022
|
return __awaiter(_this, void 0, void 0, function () {
|
|
990
1023
|
var options, maxZoom, minZoom, map;
|
|
@@ -1519,6 +1552,7 @@ var GoogleMintMapController = function (_super) {
|
|
|
1519
1552
|
var _this = this;
|
|
1520
1553
|
|
|
1521
1554
|
return __generator(this, function (_a) {
|
|
1555
|
+
this.mapDivElement = divElement;
|
|
1522
1556
|
return [2, new Promise(function (resolve) {
|
|
1523
1557
|
return __awaiter(_this, void 0, void 0, function () {
|
|
1524
1558
|
var map;
|
|
@@ -1823,6 +1857,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
1823
1857
|
} else {
|
|
1824
1858
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
1825
1859
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
1860
|
+
marker.element.parentElement.style.margin = '0';
|
|
1826
1861
|
marker.native = kakaoMarker_1;
|
|
1827
1862
|
}
|
|
1828
1863
|
|
|
@@ -1846,6 +1881,8 @@ var KakaoMintMapController = function (_super) {
|
|
|
1846
1881
|
if (options.visible !== undefined) {
|
|
1847
1882
|
marker.native.setVisible(options.visible);
|
|
1848
1883
|
}
|
|
1884
|
+
|
|
1885
|
+
marker.element.parentElement.style.margin = '0';
|
|
1849
1886
|
}
|
|
1850
1887
|
}
|
|
1851
1888
|
};
|
|
@@ -1984,6 +2021,7 @@ var KakaoMintMapController = function (_super) {
|
|
|
1984
2021
|
var _this = this;
|
|
1985
2022
|
|
|
1986
2023
|
return __generator(this, function (_a) {
|
|
2024
|
+
this.mapDivElement = divElement;
|
|
1987
2025
|
return [2, new Promise(function (resolve) {
|
|
1988
2026
|
return __awaiter(_this, void 0, void 0, function () {
|
|
1989
2027
|
var options, maxZoom, minZoom, map;
|
|
@@ -2418,6 +2456,14 @@ function PointLoading(_a) {
|
|
|
2418
2456
|
}, "".concat(text, " ").concat(pointString)));
|
|
2419
2457
|
}
|
|
2420
2458
|
|
|
2459
|
+
var MintMapCanvasRenderer = function () {
|
|
2460
|
+
function MintMapCanvasRenderer(context) {
|
|
2461
|
+
this.context = context;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
return MintMapCanvasRenderer;
|
|
2465
|
+
}();
|
|
2466
|
+
|
|
2421
2467
|
var AnimationPlayer = function () {
|
|
2422
2468
|
function AnimationPlayer(drawFunction, fps) {
|
|
2423
2469
|
this.prevtime = 0;
|
|
@@ -2622,7 +2668,7 @@ var offsetCalibration = function (mapType, divElement, options) {
|
|
|
2622
2668
|
if (mapType === 'google') {
|
|
2623
2669
|
divElement.style.transform = "translate(50%, 100%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2624
2670
|
} else if (mapType === 'kakao') {
|
|
2625
|
-
divElement.style.transform = "translate(
|
|
2671
|
+
divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2626
2672
|
}
|
|
2627
2673
|
};
|
|
2628
2674
|
|
|
@@ -3193,4 +3239,264 @@ function MapPolylineWrapper(_a) {
|
|
|
3193
3239
|
return React.createElement(React.Fragment, null, options && children);
|
|
3194
3240
|
}
|
|
3195
3241
|
|
|
3196
|
-
|
|
3242
|
+
var console$1 = {
|
|
3243
|
+
log: function () {
|
|
3244
|
+
}
|
|
3245
|
+
};
|
|
3246
|
+
function MapCanvasWrapper(_a) {
|
|
3247
|
+
var children = _a.children;
|
|
3248
|
+
__rest(_a, ["children"]);
|
|
3249
|
+
var controller = useMintMapController();
|
|
3250
|
+
|
|
3251
|
+
var _b = useState(false),
|
|
3252
|
+
renderFlag = _b[0],
|
|
3253
|
+
setRenderFlag = _b[1];
|
|
3254
|
+
|
|
3255
|
+
var invokeRender = useCallback(function () {
|
|
3256
|
+
setRenderFlag(!renderFlag);
|
|
3257
|
+
}, []);
|
|
3258
|
+
var renderer = useRef();
|
|
3259
|
+
var containerRef = useRef(null);
|
|
3260
|
+
var canvasRef = useRef(null);
|
|
3261
|
+
var contextRef = useRef();
|
|
3262
|
+
var clearRect = useCallback(function () {
|
|
3263
|
+
if (contextRef.current && canvasRef.current) {
|
|
3264
|
+
contextRef.current.clearRect(canvasRef.current.width * -1, canvasRef.current.height * -1, canvasRef.current.width * 3, canvasRef.current.height * 3);
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
return true;
|
|
3268
|
+
}, []);
|
|
3269
|
+
var scaleCanvas = useCallback(function (containerRef, canvasElement, canvasContext) {
|
|
3270
|
+
var devicePixelRatio = window.devicePixelRatio;
|
|
3271
|
+
var width = containerRef.offsetWidth;
|
|
3272
|
+
var height = containerRef.offsetHeight;
|
|
3273
|
+
canvasElement.width = width * devicePixelRatio;
|
|
3274
|
+
canvasElement.height = height * devicePixelRatio;
|
|
3275
|
+
canvasElement.style.width = "".concat(width, "px");
|
|
3276
|
+
canvasElement.style.height = "".concat(height, "px");
|
|
3277
|
+
canvasContext.scale(devicePixelRatio, devicePixelRatio);
|
|
3278
|
+
}, []);
|
|
3279
|
+
var parseClickParamToPosition = useCallback(function (mapType, e) {
|
|
3280
|
+
var latlng = e.latlng || e.latLng;
|
|
3281
|
+
|
|
3282
|
+
if (!latlng) {
|
|
3283
|
+
throw new Error("Map Type ".concat(mapType, " canvas marker click not supported (latlng not found)"));
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3286
|
+
var clickPosition = new Position(0, 0);
|
|
3287
|
+
|
|
3288
|
+
if (mapType === 'naver') {
|
|
3289
|
+
clickPosition.lat = latlng._lat;
|
|
3290
|
+
clickPosition.lng = latlng._lng;
|
|
3291
|
+
} else if (mapType === 'google') {
|
|
3292
|
+
clickPosition.lat = latlng.lat();
|
|
3293
|
+
clickPosition.lng = latlng.lng();
|
|
3294
|
+
} else if (mapType === 'kakao') {
|
|
3295
|
+
clickPosition.lat = latlng.Ma;
|
|
3296
|
+
clickPosition.lng = latlng.La;
|
|
3297
|
+
} else {
|
|
3298
|
+
throw new Error("Map Type ".concat(mapType, " canvas marker click not supported"));
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
return clickPosition;
|
|
3302
|
+
}, []);
|
|
3303
|
+
|
|
3304
|
+
var includes = function (point, targetPoint, width, height) {
|
|
3305
|
+
if (point.x >= targetPoint.x && point.x <= targetPoint.x + width && point.y >= targetPoint.y && point.y <= targetPoint.y + height) {
|
|
3306
|
+
return true;
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
return false;
|
|
3310
|
+
};
|
|
3311
|
+
|
|
3312
|
+
var processMouseEvent = useCallback(function (clickedOffset, eventName) {
|
|
3313
|
+
var items = renderItemsOnView.current;
|
|
3314
|
+
var hitSet = new Set();
|
|
3315
|
+
|
|
3316
|
+
for (var i = items.length - 1; i >= 0; i--) {
|
|
3317
|
+
var item = items[i];
|
|
3318
|
+
|
|
3319
|
+
if (item.visible === undefined || item.visible) {
|
|
3320
|
+
var event_1 = item[eventName];
|
|
3321
|
+
|
|
3322
|
+
if (!event_1) {
|
|
3323
|
+
continue;
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
var pos = item.position;
|
|
3327
|
+
|
|
3328
|
+
if (pos && !pos.offset) {
|
|
3329
|
+
pos.offset = controller.positionToOffset(pos);
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
|
|
3333
|
+
continue;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
event_1(clickedOffset);
|
|
3337
|
+
hitSet.add(item);
|
|
3338
|
+
break;
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
return hitSet;
|
|
3343
|
+
}, []);
|
|
3344
|
+
useEffect(function () {
|
|
3345
|
+
var resizeObserver;
|
|
3346
|
+
|
|
3347
|
+
if (canvasRef.current && containerRef.current) {
|
|
3348
|
+
resizeObserver = new ResizeObserver(function (entries) {
|
|
3349
|
+
var elem = entries[0];
|
|
3350
|
+
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current);
|
|
3351
|
+
renderMain();
|
|
3352
|
+
});
|
|
3353
|
+
resizeObserver.observe(containerRef.current);
|
|
3354
|
+
var map = controller.getMap();
|
|
3355
|
+
|
|
3356
|
+
if (map) {
|
|
3357
|
+
map.addListener('zooming', function () {
|
|
3358
|
+
clearRect();
|
|
3359
|
+
});
|
|
3360
|
+
map.addListener('zoom_start', function () {
|
|
3361
|
+
clearRect();
|
|
3362
|
+
});
|
|
3363
|
+
map.addListener('center_changed', function () {
|
|
3364
|
+
|
|
3365
|
+
if (containerRef.current) {
|
|
3366
|
+
containerRef.current.style.visibility = 'hidden';
|
|
3367
|
+
}
|
|
3368
|
+
});
|
|
3369
|
+
map.addListener('idle', function () {
|
|
3370
|
+
|
|
3371
|
+
if (containerRef.current) {
|
|
3372
|
+
containerRef.current.style.visibility = '';
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
clearRect();
|
|
3376
|
+
invokeRender();
|
|
3377
|
+
});
|
|
3378
|
+
map.addListener('mousemove', function (e) {
|
|
3379
|
+
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3380
|
+
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
3381
|
+
var hitSet = processMouseEvent(clickedOffset, 'onMouseOver');
|
|
3382
|
+
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
3383
|
+
if (!hitSet.has(item)) {
|
|
3384
|
+
item.onMouseOut && item.onMouseOut(clickedOffset);
|
|
3385
|
+
}
|
|
3386
|
+
});
|
|
3387
|
+
renderItemsMouseOverStatus.current = hitSet;
|
|
3388
|
+
});
|
|
3389
|
+
map.addListener('click', function (e) {
|
|
3390
|
+
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3391
|
+
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
3392
|
+
processMouseEvent(clickedOffset, 'onClick');
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
contextRef.current = canvasRef.current.getContext('2d');
|
|
3397
|
+
|
|
3398
|
+
if (contextRef.current) {
|
|
3399
|
+
scaleCanvas(containerRef.current, canvasRef.current, contextRef.current);
|
|
3400
|
+
renderer.current = new MintMapCanvasRenderer(contextRef.current);
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
|
|
3404
|
+
return function () {
|
|
3405
|
+
resizeObserver && resizeObserver.disconnect();
|
|
3406
|
+
};
|
|
3407
|
+
}, []);
|
|
3408
|
+
var renderItems = useRef([]);
|
|
3409
|
+
var renderItemsOnView = useRef([]);
|
|
3410
|
+
var renderItemsMouseOverStatus = useRef(new Set());
|
|
3411
|
+
useEffect(function () {
|
|
3412
|
+
renderItems.current = (Array.isArray(children) ? children : [children]).map(function (item) {
|
|
3413
|
+
return item.props;
|
|
3414
|
+
});
|
|
3415
|
+
var zIndexList = [];
|
|
3416
|
+
var undefinedList = [];
|
|
3417
|
+
|
|
3418
|
+
for (var _i = 0, _a = renderItems.current; _i < _a.length; _i++) {
|
|
3419
|
+
var item = _a[_i];
|
|
3420
|
+
|
|
3421
|
+
if (item.zIndex !== undefined) {
|
|
3422
|
+
zIndexList.push(item);
|
|
3423
|
+
} else {
|
|
3424
|
+
undefinedList.push(item);
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
renderItems.current = undefinedList;
|
|
3429
|
+
zIndexList.sort(function (a, b) {
|
|
3430
|
+
return a > b ? 1 : -1;
|
|
3431
|
+
}).forEach(function (item) {
|
|
3432
|
+
renderItems.current.push(item);
|
|
3433
|
+
});
|
|
3434
|
+
}, [children]);
|
|
3435
|
+
var renderMain = useCallback(function () {
|
|
3436
|
+
var ctx = contextRef.current;
|
|
3437
|
+
var container = containerRef.current;
|
|
3438
|
+
|
|
3439
|
+
if (!ctx || !container || !renderer.current) {
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
clearRect();
|
|
3444
|
+
var t = new Date().getTime();
|
|
3445
|
+
var items = renderItems.current;
|
|
3446
|
+
renderItemsOnView.current.length = 0;
|
|
3447
|
+
var newSet = new Set();
|
|
3448
|
+
|
|
3449
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
3450
|
+
var item = items_1[_i];
|
|
3451
|
+
|
|
3452
|
+
if (item.visible === undefined || item.visible) {
|
|
3453
|
+
var pos = item.position;
|
|
3454
|
+
pos.offset = controller.positionToOffset(pos);
|
|
3455
|
+
|
|
3456
|
+
if (item.anchor) {
|
|
3457
|
+
pos.offset.x += item.anchor.x;
|
|
3458
|
+
pos.offset.y += item.anchor.y;
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
console$1.log('canvas marker', pos.offset);
|
|
3462
|
+
|
|
3463
|
+
if (pos.offset.x < 0 || pos.offset.x > container.offsetWidth || pos.offset.y < 0 || pos.offset.y > container.offsetHeight) {
|
|
3464
|
+
continue;
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
item.renderer(renderer.current, pos.offset, item.payload);
|
|
3468
|
+
renderItemsOnView.current.push(item);
|
|
3469
|
+
newSet.add(item);
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
3474
|
+
if (!newSet.has(item)) {
|
|
3475
|
+
renderItemsMouseOverStatus.current.delete(item);
|
|
3476
|
+
}
|
|
3477
|
+
});
|
|
3478
|
+
console$1.log("[render ends] ".concat(new Date().getTime() - t, " ms"));
|
|
3479
|
+
}, []);
|
|
3480
|
+
renderMain();
|
|
3481
|
+
return React.createElement("div", {
|
|
3482
|
+
ref: containerRef,
|
|
3483
|
+
style: {
|
|
3484
|
+
position: 'absolute',
|
|
3485
|
+
width: '100%',
|
|
3486
|
+
height: '100%',
|
|
3487
|
+
zIndex: 2,
|
|
3488
|
+
pointerEvents: 'none'
|
|
3489
|
+
}
|
|
3490
|
+
}, React.createElement("canvas", {
|
|
3491
|
+
ref: canvasRef,
|
|
3492
|
+
style: {
|
|
3493
|
+
pointerEvents: 'revert-layer'
|
|
3494
|
+
}
|
|
3495
|
+
}), renderFlag && React.createElement(React.Fragment, null));
|
|
3496
|
+
}
|
|
3497
|
+
|
|
3498
|
+
function MapCanvasMarkerWrapper(_props) {
|
|
3499
|
+
return React.createElement(React.Fragment, null);
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
export { AnimationPlayer, Bounds, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapCanvasMarkerWrapper, MapCanvasWrapper, MapControlWrapper, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, Marker, MintMap, MintMapCanvasRenderer, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, Polygon, PolygonCalculator, Polyline, Position, getClusterInfo, useMarkerMoving, useMintMapController, waiting };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var MintMap = require('./components/mint-map/MintMap.js');
|
|
6
6
|
var MintMapCore = require('./components/mint-map/core/MintMapCore.js');
|
|
7
7
|
var MintMapController = require('./components/mint-map/core/MintMapController.js');
|
|
8
|
+
var MintMapCanvasRenderer = require('./components/mint-map/core/MintMapCanvasRenderer.js');
|
|
8
9
|
var MapBuildingProjection = require('./components/mint-map/core/advanced/MapBuildingProjection.js');
|
|
9
10
|
var MarkerMovingHook = require('./components/mint-map/core/hooks/MarkerMovingHook.js');
|
|
10
11
|
var MintMapProvider = require('./components/mint-map/core/provider/MintMapProvider.js');
|
|
@@ -16,6 +17,8 @@ var MapControlWrapper = require('./components/mint-map/core/wrapper/MapControlWr
|
|
|
16
17
|
var MapMarkerWrapper = require('./components/mint-map/core/wrapper/MapMarkerWrapper.js');
|
|
17
18
|
var MapPolygonWrapper = require('./components/mint-map/core/wrapper/MapPolygonWrapper.js');
|
|
18
19
|
var MapPolylineWrapper = require('./components/mint-map/core/wrapper/MapPolylineWrapper.js');
|
|
20
|
+
var MapCanvasWrapper = require('./components/mint-map/core/wrapper/MapCanvasWrapper.js');
|
|
21
|
+
var MapCanvasMarkerWrapper = require('./components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js');
|
|
19
22
|
var NaverMintMapController = require('./components/mint-map/naver/NaverMintMapController.js');
|
|
20
23
|
var GoogleMintMapController = require('./components/mint-map/google/GoogleMintMapController.js');
|
|
21
24
|
|
|
@@ -31,6 +34,7 @@ exports.Polyline = MintMap.Polyline;
|
|
|
31
34
|
exports.Position = MintMap.Position;
|
|
32
35
|
exports.MintMapCore = MintMapCore.MintMapCore;
|
|
33
36
|
exports.MintMapController = MintMapController.MintMapController;
|
|
37
|
+
exports.MintMapCanvasRenderer = MintMapCanvasRenderer.MintMapCanvasRenderer;
|
|
34
38
|
exports.MapBuildingProjection = MapBuildingProjection.MapBuildingProjection;
|
|
35
39
|
exports.useMarkerMoving = MarkerMovingHook.useMarkerMoving;
|
|
36
40
|
exports.MintMapProvider = MintMapProvider.MintMapProvider;
|
|
@@ -44,5 +48,7 @@ exports.MapControlWrapper = MapControlWrapper.MapControlWrapper;
|
|
|
44
48
|
exports.MapMarkerWrapper = MapMarkerWrapper.MapMarkerWrapper;
|
|
45
49
|
exports.MapPolygonWrapper = MapPolygonWrapper.MapPolygonWrapper;
|
|
46
50
|
exports.MapPolylineWrapper = MapPolylineWrapper.MapPolylineWrapper;
|
|
51
|
+
exports.MapCanvasWrapper = MapCanvasWrapper.MapCanvasWrapper;
|
|
52
|
+
exports.MapCanvasMarkerWrapper = MapCanvasMarkerWrapper.MapCanvasMarkerWrapper;
|
|
47
53
|
exports.NaverMintMapController = NaverMintMapController.NaverMintMapController;
|
|
48
54
|
exports.GoogleMintMapController = GoogleMintMapController.GoogleMintMapController;
|
package/dist/index.umd.js
CHANGED
|
@@ -346,6 +346,38 @@
|
|
|
346
346
|
return this.type;
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
+
MintMapController.prototype.positionToOffset = function (position) {
|
|
350
|
+
var div = this.mapDivElement;
|
|
351
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
352
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
353
|
+
var bounds = this.getCurrBounds();
|
|
354
|
+
var maxLng = bounds.ne.lng;
|
|
355
|
+
var minLng = bounds.sw.lng;
|
|
356
|
+
var lng = Math.abs(maxLng - minLng);
|
|
357
|
+
var x = w * (position.lng - minLng) / lng;
|
|
358
|
+
var maxLat = bounds.ne.lat;
|
|
359
|
+
var minLat = bounds.sw.lat;
|
|
360
|
+
var lat = Math.abs(maxLat - minLat);
|
|
361
|
+
var y = h * (maxLat - position.lat) / lat;
|
|
362
|
+
return new Offset(x, y);
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
MintMapController.prototype.offsetToPosition = function (offset) {
|
|
366
|
+
var div = this.mapDivElement;
|
|
367
|
+
var w = div === null || div === void 0 ? void 0 : div.offsetWidth;
|
|
368
|
+
var h = div === null || div === void 0 ? void 0 : div.offsetHeight;
|
|
369
|
+
var bounds = this.getCurrBounds();
|
|
370
|
+
var maxLng = bounds.ne.lng;
|
|
371
|
+
var minLng = bounds.sw.lng;
|
|
372
|
+
var lng = Math.abs(maxLng - minLng);
|
|
373
|
+
var lngVal = offset.x * lng / w + minLng;
|
|
374
|
+
var maxLat = bounds.ne.lat;
|
|
375
|
+
var minLat = bounds.sw.lat;
|
|
376
|
+
var lat = Math.abs(maxLat - minLat);
|
|
377
|
+
var latVal = (offset.y * lat / h - maxLat) * -1;
|
|
378
|
+
return new Position(latVal, lngVal);
|
|
379
|
+
};
|
|
380
|
+
|
|
349
381
|
MintMapController.prototype.loadScript = function (url, id) {
|
|
350
382
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
351
383
|
return tslib.__generator(this, function (_a) {
|
|
@@ -990,6 +1022,7 @@
|
|
|
990
1022
|
var _this = this;
|
|
991
1023
|
|
|
992
1024
|
return tslib.__generator(this, function (_a) {
|
|
1025
|
+
this.mapDivElement = divElement;
|
|
993
1026
|
return [2, new Promise(function (resolve) {
|
|
994
1027
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
995
1028
|
var options, maxZoom, minZoom, map;
|
|
@@ -1524,6 +1557,7 @@
|
|
|
1524
1557
|
var _this = this;
|
|
1525
1558
|
|
|
1526
1559
|
return tslib.__generator(this, function (_a) {
|
|
1560
|
+
this.mapDivElement = divElement;
|
|
1527
1561
|
return [2, new Promise(function (resolve) {
|
|
1528
1562
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1529
1563
|
var map;
|
|
@@ -1828,6 +1862,7 @@
|
|
|
1828
1862
|
} else {
|
|
1829
1863
|
kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
|
|
1830
1864
|
marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
|
|
1865
|
+
marker.element.parentElement.style.margin = '0';
|
|
1831
1866
|
marker.native = kakaoMarker_1;
|
|
1832
1867
|
}
|
|
1833
1868
|
|
|
@@ -1851,6 +1886,8 @@
|
|
|
1851
1886
|
if (options.visible !== undefined) {
|
|
1852
1887
|
marker.native.setVisible(options.visible);
|
|
1853
1888
|
}
|
|
1889
|
+
|
|
1890
|
+
marker.element.parentElement.style.margin = '0';
|
|
1854
1891
|
}
|
|
1855
1892
|
}
|
|
1856
1893
|
};
|
|
@@ -1989,6 +2026,7 @@
|
|
|
1989
2026
|
var _this = this;
|
|
1990
2027
|
|
|
1991
2028
|
return tslib.__generator(this, function (_a) {
|
|
2029
|
+
this.mapDivElement = divElement;
|
|
1992
2030
|
return [2, new Promise(function (resolve) {
|
|
1993
2031
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1994
2032
|
var options, maxZoom, minZoom, map;
|
|
@@ -2423,6 +2461,14 @@
|
|
|
2423
2461
|
}, "".concat(text, " ").concat(pointString)));
|
|
2424
2462
|
}
|
|
2425
2463
|
|
|
2464
|
+
var MintMapCanvasRenderer = function () {
|
|
2465
|
+
function MintMapCanvasRenderer(context) {
|
|
2466
|
+
this.context = context;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
return MintMapCanvasRenderer;
|
|
2470
|
+
}();
|
|
2471
|
+
|
|
2426
2472
|
var AnimationPlayer = function () {
|
|
2427
2473
|
function AnimationPlayer(drawFunction, fps) {
|
|
2428
2474
|
this.prevtime = 0;
|
|
@@ -2627,7 +2673,7 @@
|
|
|
2627
2673
|
if (mapType === 'google') {
|
|
2628
2674
|
divElement.style.transform = "translate(50%, 100%) translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2629
2675
|
} else if (mapType === 'kakao') {
|
|
2630
|
-
divElement.style.transform = "translate(
|
|
2676
|
+
divElement.style.transform = "translate(-".concat(options.anchor ? options.anchor.x : '0', "px, -").concat(options.anchor ? options.anchor.y : '0', "px)");
|
|
2631
2677
|
}
|
|
2632
2678
|
};
|
|
2633
2679
|
|
|
@@ -3198,18 +3244,281 @@
|
|
|
3198
3244
|
return React__default["default"].createElement(React__default["default"].Fragment, null, options && children);
|
|
3199
3245
|
}
|
|
3200
3246
|
|
|
3247
|
+
var console$1 = {
|
|
3248
|
+
log: function () {
|
|
3249
|
+
}
|
|
3250
|
+
};
|
|
3251
|
+
function MapCanvasWrapper(_a) {
|
|
3252
|
+
var children = _a.children;
|
|
3253
|
+
tslib.__rest(_a, ["children"]);
|
|
3254
|
+
var controller = useMintMapController();
|
|
3255
|
+
|
|
3256
|
+
var _b = React.useState(false),
|
|
3257
|
+
renderFlag = _b[0],
|
|
3258
|
+
setRenderFlag = _b[1];
|
|
3259
|
+
|
|
3260
|
+
var invokeRender = React.useCallback(function () {
|
|
3261
|
+
setRenderFlag(!renderFlag);
|
|
3262
|
+
}, []);
|
|
3263
|
+
var renderer = React.useRef();
|
|
3264
|
+
var containerRef = React.useRef(null);
|
|
3265
|
+
var canvasRef = React.useRef(null);
|
|
3266
|
+
var contextRef = React.useRef();
|
|
3267
|
+
var clearRect = React.useCallback(function () {
|
|
3268
|
+
if (contextRef.current && canvasRef.current) {
|
|
3269
|
+
contextRef.current.clearRect(canvasRef.current.width * -1, canvasRef.current.height * -1, canvasRef.current.width * 3, canvasRef.current.height * 3);
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
return true;
|
|
3273
|
+
}, []);
|
|
3274
|
+
var scaleCanvas = React.useCallback(function (containerRef, canvasElement, canvasContext) {
|
|
3275
|
+
var devicePixelRatio = window.devicePixelRatio;
|
|
3276
|
+
var width = containerRef.offsetWidth;
|
|
3277
|
+
var height = containerRef.offsetHeight;
|
|
3278
|
+
canvasElement.width = width * devicePixelRatio;
|
|
3279
|
+
canvasElement.height = height * devicePixelRatio;
|
|
3280
|
+
canvasElement.style.width = "".concat(width, "px");
|
|
3281
|
+
canvasElement.style.height = "".concat(height, "px");
|
|
3282
|
+
canvasContext.scale(devicePixelRatio, devicePixelRatio);
|
|
3283
|
+
}, []);
|
|
3284
|
+
var parseClickParamToPosition = React.useCallback(function (mapType, e) {
|
|
3285
|
+
var latlng = e.latlng || e.latLng;
|
|
3286
|
+
|
|
3287
|
+
if (!latlng) {
|
|
3288
|
+
throw new Error("Map Type ".concat(mapType, " canvas marker click not supported (latlng not found)"));
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
var clickPosition = new Position(0, 0);
|
|
3292
|
+
|
|
3293
|
+
if (mapType === 'naver') {
|
|
3294
|
+
clickPosition.lat = latlng._lat;
|
|
3295
|
+
clickPosition.lng = latlng._lng;
|
|
3296
|
+
} else if (mapType === 'google') {
|
|
3297
|
+
clickPosition.lat = latlng.lat();
|
|
3298
|
+
clickPosition.lng = latlng.lng();
|
|
3299
|
+
} else if (mapType === 'kakao') {
|
|
3300
|
+
clickPosition.lat = latlng.Ma;
|
|
3301
|
+
clickPosition.lng = latlng.La;
|
|
3302
|
+
} else {
|
|
3303
|
+
throw new Error("Map Type ".concat(mapType, " canvas marker click not supported"));
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
return clickPosition;
|
|
3307
|
+
}, []);
|
|
3308
|
+
|
|
3309
|
+
var includes = function (point, targetPoint, width, height) {
|
|
3310
|
+
if (point.x >= targetPoint.x && point.x <= targetPoint.x + width && point.y >= targetPoint.y && point.y <= targetPoint.y + height) {
|
|
3311
|
+
return true;
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3314
|
+
return false;
|
|
3315
|
+
};
|
|
3316
|
+
|
|
3317
|
+
var processMouseEvent = React.useCallback(function (clickedOffset, eventName) {
|
|
3318
|
+
var items = renderItemsOnView.current;
|
|
3319
|
+
var hitSet = new Set();
|
|
3320
|
+
|
|
3321
|
+
for (var i = items.length - 1; i >= 0; i--) {
|
|
3322
|
+
var item = items[i];
|
|
3323
|
+
|
|
3324
|
+
if (item.visible === undefined || item.visible) {
|
|
3325
|
+
var event_1 = item[eventName];
|
|
3326
|
+
|
|
3327
|
+
if (!event_1) {
|
|
3328
|
+
continue;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
var pos = item.position;
|
|
3332
|
+
|
|
3333
|
+
if (pos && !pos.offset) {
|
|
3334
|
+
pos.offset = controller.positionToOffset(pos);
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
if (!pos || !pos.offset || !includes(clickedOffset, pos.offset, item.boxWidth, item.boxHeight)) {
|
|
3338
|
+
continue;
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
event_1(clickedOffset);
|
|
3342
|
+
hitSet.add(item);
|
|
3343
|
+
break;
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
return hitSet;
|
|
3348
|
+
}, []);
|
|
3349
|
+
React.useEffect(function () {
|
|
3350
|
+
var resizeObserver;
|
|
3351
|
+
|
|
3352
|
+
if (canvasRef.current && containerRef.current) {
|
|
3353
|
+
resizeObserver = new ResizeObserver(function (entries) {
|
|
3354
|
+
var elem = entries[0];
|
|
3355
|
+
canvasRef.current && contextRef.current && scaleCanvas(elem.target, canvasRef.current, contextRef.current);
|
|
3356
|
+
renderMain();
|
|
3357
|
+
});
|
|
3358
|
+
resizeObserver.observe(containerRef.current);
|
|
3359
|
+
var map = controller.getMap();
|
|
3360
|
+
|
|
3361
|
+
if (map) {
|
|
3362
|
+
map.addListener('zooming', function () {
|
|
3363
|
+
clearRect();
|
|
3364
|
+
});
|
|
3365
|
+
map.addListener('zoom_start', function () {
|
|
3366
|
+
clearRect();
|
|
3367
|
+
});
|
|
3368
|
+
map.addListener('center_changed', function () {
|
|
3369
|
+
|
|
3370
|
+
if (containerRef.current) {
|
|
3371
|
+
containerRef.current.style.visibility = 'hidden';
|
|
3372
|
+
}
|
|
3373
|
+
});
|
|
3374
|
+
map.addListener('idle', function () {
|
|
3375
|
+
|
|
3376
|
+
if (containerRef.current) {
|
|
3377
|
+
containerRef.current.style.visibility = '';
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
clearRect();
|
|
3381
|
+
invokeRender();
|
|
3382
|
+
});
|
|
3383
|
+
map.addListener('mousemove', function (e) {
|
|
3384
|
+
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3385
|
+
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
3386
|
+
var hitSet = processMouseEvent(clickedOffset, 'onMouseOver');
|
|
3387
|
+
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
3388
|
+
if (!hitSet.has(item)) {
|
|
3389
|
+
item.onMouseOut && item.onMouseOut(clickedOffset);
|
|
3390
|
+
}
|
|
3391
|
+
});
|
|
3392
|
+
renderItemsMouseOverStatus.current = hitSet;
|
|
3393
|
+
});
|
|
3394
|
+
map.addListener('click', function (e) {
|
|
3395
|
+
var clickPosition = parseClickParamToPosition(controller.getMapType(), e);
|
|
3396
|
+
var clickedOffset = controller.positionToOffset(clickPosition);
|
|
3397
|
+
processMouseEvent(clickedOffset, 'onClick');
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
contextRef.current = canvasRef.current.getContext('2d');
|
|
3402
|
+
|
|
3403
|
+
if (contextRef.current) {
|
|
3404
|
+
scaleCanvas(containerRef.current, canvasRef.current, contextRef.current);
|
|
3405
|
+
renderer.current = new MintMapCanvasRenderer(contextRef.current);
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3409
|
+
return function () {
|
|
3410
|
+
resizeObserver && resizeObserver.disconnect();
|
|
3411
|
+
};
|
|
3412
|
+
}, []);
|
|
3413
|
+
var renderItems = React.useRef([]);
|
|
3414
|
+
var renderItemsOnView = React.useRef([]);
|
|
3415
|
+
var renderItemsMouseOverStatus = React.useRef(new Set());
|
|
3416
|
+
React.useEffect(function () {
|
|
3417
|
+
renderItems.current = (Array.isArray(children) ? children : [children]).map(function (item) {
|
|
3418
|
+
return item.props;
|
|
3419
|
+
});
|
|
3420
|
+
var zIndexList = [];
|
|
3421
|
+
var undefinedList = [];
|
|
3422
|
+
|
|
3423
|
+
for (var _i = 0, _a = renderItems.current; _i < _a.length; _i++) {
|
|
3424
|
+
var item = _a[_i];
|
|
3425
|
+
|
|
3426
|
+
if (item.zIndex !== undefined) {
|
|
3427
|
+
zIndexList.push(item);
|
|
3428
|
+
} else {
|
|
3429
|
+
undefinedList.push(item);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
renderItems.current = undefinedList;
|
|
3434
|
+
zIndexList.sort(function (a, b) {
|
|
3435
|
+
return a > b ? 1 : -1;
|
|
3436
|
+
}).forEach(function (item) {
|
|
3437
|
+
renderItems.current.push(item);
|
|
3438
|
+
});
|
|
3439
|
+
}, [children]);
|
|
3440
|
+
var renderMain = React.useCallback(function () {
|
|
3441
|
+
var ctx = contextRef.current;
|
|
3442
|
+
var container = containerRef.current;
|
|
3443
|
+
|
|
3444
|
+
if (!ctx || !container || !renderer.current) {
|
|
3445
|
+
return;
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
clearRect();
|
|
3449
|
+
var t = new Date().getTime();
|
|
3450
|
+
var items = renderItems.current;
|
|
3451
|
+
renderItemsOnView.current.length = 0;
|
|
3452
|
+
var newSet = new Set();
|
|
3453
|
+
|
|
3454
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
3455
|
+
var item = items_1[_i];
|
|
3456
|
+
|
|
3457
|
+
if (item.visible === undefined || item.visible) {
|
|
3458
|
+
var pos = item.position;
|
|
3459
|
+
pos.offset = controller.positionToOffset(pos);
|
|
3460
|
+
|
|
3461
|
+
if (item.anchor) {
|
|
3462
|
+
pos.offset.x += item.anchor.x;
|
|
3463
|
+
pos.offset.y += item.anchor.y;
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3466
|
+
console$1.log('canvas marker', pos.offset);
|
|
3467
|
+
|
|
3468
|
+
if (pos.offset.x < 0 || pos.offset.x > container.offsetWidth || pos.offset.y < 0 || pos.offset.y > container.offsetHeight) {
|
|
3469
|
+
continue;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
item.renderer(renderer.current, pos.offset, item.payload);
|
|
3473
|
+
renderItemsOnView.current.push(item);
|
|
3474
|
+
newSet.add(item);
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
renderItemsMouseOverStatus.current.forEach(function (item) {
|
|
3479
|
+
if (!newSet.has(item)) {
|
|
3480
|
+
renderItemsMouseOverStatus.current.delete(item);
|
|
3481
|
+
}
|
|
3482
|
+
});
|
|
3483
|
+
console$1.log("[render ends] ".concat(new Date().getTime() - t, " ms"));
|
|
3484
|
+
}, []);
|
|
3485
|
+
renderMain();
|
|
3486
|
+
return React__default["default"].createElement("div", {
|
|
3487
|
+
ref: containerRef,
|
|
3488
|
+
style: {
|
|
3489
|
+
position: 'absolute',
|
|
3490
|
+
width: '100%',
|
|
3491
|
+
height: '100%',
|
|
3492
|
+
zIndex: 2,
|
|
3493
|
+
pointerEvents: 'none'
|
|
3494
|
+
}
|
|
3495
|
+
}, React__default["default"].createElement("canvas", {
|
|
3496
|
+
ref: canvasRef,
|
|
3497
|
+
style: {
|
|
3498
|
+
pointerEvents: 'revert-layer'
|
|
3499
|
+
}
|
|
3500
|
+
}), renderFlag && React__default["default"].createElement(React__default["default"].Fragment, null));
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
function MapCanvasMarkerWrapper(_props) {
|
|
3504
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3201
3507
|
exports.AnimationPlayer = AnimationPlayer;
|
|
3202
3508
|
exports.Bounds = Bounds;
|
|
3203
3509
|
exports.Drawable = Drawable;
|
|
3204
3510
|
exports.GeoCalulator = GeoCalulator;
|
|
3205
3511
|
exports.GoogleMintMapController = GoogleMintMapController;
|
|
3206
3512
|
exports.MapBuildingProjection = MapBuildingProjection;
|
|
3513
|
+
exports.MapCanvasMarkerWrapper = MapCanvasMarkerWrapper;
|
|
3514
|
+
exports.MapCanvasWrapper = MapCanvasWrapper;
|
|
3207
3515
|
exports.MapControlWrapper = MapControlWrapper;
|
|
3208
3516
|
exports.MapMarkerWrapper = MapMarkerWrapper;
|
|
3209
3517
|
exports.MapPolygonWrapper = MapPolygonWrapper;
|
|
3210
3518
|
exports.MapPolylineWrapper = MapPolylineWrapper;
|
|
3211
3519
|
exports.Marker = Marker;
|
|
3212
3520
|
exports.MintMap = MintMap;
|
|
3521
|
+
exports.MintMapCanvasRenderer = MintMapCanvasRenderer;
|
|
3213
3522
|
exports.MintMapController = MintMapController;
|
|
3214
3523
|
exports.MintMapCore = MintMapCore;
|
|
3215
3524
|
exports.MintMapProvider = MintMapProvider;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mint-ui/map",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1-beta",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"browser": "./dist/index.umd.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"repository": "https://github.com/dev-rsquare/mint-ui-map",
|
|
9
9
|
"author": "RSQUARE",
|
|
10
|
-
"keywords": ["react", "map", "google", "naver", "library", "typescript"],
|
|
10
|
+
"keywords": ["react", "map", "google", "naver", "kakao", "library", "typescript", "canvas", "marker"],
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"private": false,
|
|
13
13
|
"devDependencies": {
|