@mint-ui/map 0.9.2-beta-test1 → 0.9.2-beta-test2
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/canvas/CanvasMarker.d.ts +6 -7
- package/dist/components/mint-map/core/advanced/canvas/CanvasMarker.js +16 -4
- package/dist/components/mint-map/core/advanced/canvas/draw/canvas-util.d.ts +2 -2
- package/dist/components/mint-map/core/advanced/canvas/draw/canvas-util.js +8 -10
- package/dist/index.es.js +24 -14
- package/dist/index.umd.js +24 -14
- package/package.json +1 -1
|
@@ -2,18 +2,17 @@ import React from "react";
|
|
|
2
2
|
import { MarkerOptions, Offset, Position } from "../../../types";
|
|
3
3
|
export interface CanvasMarkerRendererParams<T> {
|
|
4
4
|
context: CanvasRenderingContext2D;
|
|
5
|
-
offset: Offset;
|
|
6
|
-
payload?: T
|
|
5
|
+
offset: Offset[];
|
|
6
|
+
payload?: CanvasMarkerData<T>;
|
|
7
7
|
}
|
|
8
|
-
export interface CanvasMarkerOption
|
|
9
|
-
position
|
|
10
|
-
anchor?: Offset;
|
|
8
|
+
export interface CanvasMarkerOption {
|
|
9
|
+
position?: Position[];
|
|
11
10
|
visible?: boolean;
|
|
12
|
-
payload?: T;
|
|
13
11
|
}
|
|
12
|
+
export declare type CanvasMarkerData<T> = T & CanvasMarkerOption;
|
|
14
13
|
export declare type CanvasMarkerRenderFunction<T> = (params: CanvasMarkerRendererParams<T>) => void;
|
|
15
14
|
export interface CanvasMarkerProps<T> extends Pick<MarkerOptions, 'zIndex' | 'anchor' | 'visible'> {
|
|
16
15
|
renderer: CanvasMarkerRenderFunction<T>;
|
|
17
|
-
data:
|
|
16
|
+
data: CanvasMarkerData<T>[];
|
|
18
17
|
}
|
|
19
18
|
export declare function CanvasMarker<T>({ renderer, data, ...options }: CanvasMarkerProps<T>): React.ReactPortal;
|
|
@@ -86,6 +86,14 @@ function CanvasMarker(_a) {
|
|
|
86
86
|
markerRef.current && controller.updateMarker(markerRef.current, markerOptions); // 렌더링
|
|
87
87
|
|
|
88
88
|
canvasUtil.renderMain(controller, rendererRef.current, containerRef.current, canvasRef.current, contextRef.current, dataRef.current);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var handleZoomStart = function () {
|
|
92
|
+
containerRef.current && (containerRef.current.style.visibility = 'hidden');
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var handleZoomEnd = function () {
|
|
96
|
+
containerRef.current && (containerRef.current.style.visibility = '');
|
|
89
97
|
}; //initialize
|
|
90
98
|
|
|
91
99
|
|
|
@@ -95,17 +103,19 @@ function CanvasMarker(_a) {
|
|
|
95
103
|
if (canvasRef.current && containerRef.current) {
|
|
96
104
|
// 리사이즈 처리
|
|
97
105
|
resizeObserver = new ResizeObserver(function () {
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
// 클리어
|
|
100
107
|
canvasUtil.clearRect(canvasRef.current, contextRef.current); // 스케일링
|
|
101
108
|
|
|
102
109
|
canvasRef.current && contextRef.current && canvasUtil.scaleCanvas(controller, canvasRef.current, contextRef.current); // 렌더링
|
|
103
110
|
|
|
104
111
|
canvasUtil.renderMain(controller, rendererRef.current, containerRef.current, canvasRef.current, contextRef.current, dataRef.current);
|
|
105
112
|
});
|
|
106
|
-
resizeObserver.observe(
|
|
113
|
+
resizeObserver.observe(controller.mapDivElement); // IDLE 이벤트 등록
|
|
114
|
+
|
|
115
|
+
controller.addEventListener('IDLE', handleIdle); // 줌 처리
|
|
107
116
|
|
|
108
|
-
controller.addEventListener('
|
|
117
|
+
controller.addEventListener('ZOOMSTART', handleZoomStart);
|
|
118
|
+
controller.addEventListener('ZOOM_CHANGED', handleZoomEnd); // 2d 컨텍스트
|
|
109
119
|
|
|
110
120
|
contextRef.current = canvasRef.current.getContext('2d'); // 스케일링
|
|
111
121
|
|
|
@@ -117,6 +127,8 @@ function CanvasMarker(_a) {
|
|
|
117
127
|
return function () {
|
|
118
128
|
resizeObserver && resizeObserver.disconnect();
|
|
119
129
|
controller.removeEventListener('IDLE', handleIdle);
|
|
130
|
+
controller.removeEventListener('ZOOMSTART', handleZoomStart);
|
|
131
|
+
controller.removeEventListener('ZOOM_CHANGED', handleZoomEnd);
|
|
120
132
|
};
|
|
121
133
|
}, []); // data ref
|
|
122
134
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MintMapController } from "../../../MintMapController";
|
|
2
|
-
import {
|
|
2
|
+
import { CanvasMarkerData, CanvasMarkerRenderFunction } from "../CanvasMarker";
|
|
3
3
|
export declare const scaleCanvas: (controller: MintMapController, canvasElement: HTMLCanvasElement, canvasContext: CanvasRenderingContext2D) => void;
|
|
4
4
|
export declare const clearRect: (canvas: HTMLCanvasElement | null, context?: CanvasRenderingContext2D | null) => boolean;
|
|
5
|
-
export declare function renderMain<T>(controller: MintMapController, renderer: CanvasMarkerRenderFunction<T>, container?: HTMLDivElement | null, canvas?: HTMLCanvasElement | null, context?: CanvasRenderingContext2D | null, data?:
|
|
5
|
+
export declare function renderMain<T>(controller: MintMapController, renderer: CanvasMarkerRenderFunction<T>, container?: HTMLDivElement | null, canvas?: HTMLCanvasElement | null, context?: CanvasRenderingContext2D | null, data?: CanvasMarkerData<T>[]): void;
|
|
@@ -31,21 +31,19 @@ function renderMain(controller, renderer, container, canvas, context, data) {
|
|
|
31
31
|
clearRect(canvas, context); //draw
|
|
32
32
|
|
|
33
33
|
data.forEach(function (item) {
|
|
34
|
-
|
|
35
|
-
var pos = item.position; //위치 변환
|
|
36
|
-
|
|
37
|
-
pos.offset = controller.positionToOffset(pos);
|
|
34
|
+
var _a; // 그리기 대상이면
|
|
38
35
|
|
|
39
|
-
if (item.anchor) {
|
|
40
|
-
pos.offset.x += item.anchor.x;
|
|
41
|
-
pos.offset.y += item.anchor.y;
|
|
42
|
-
} //그리기
|
|
43
36
|
|
|
37
|
+
if (item.visible === undefined || item.visible) {
|
|
38
|
+
//위치 변환
|
|
39
|
+
var offset = ((_a = item.position) === null || _a === void 0 ? void 0 : _a.map(function (pos) {
|
|
40
|
+
return controller.positionToOffset(pos);
|
|
41
|
+
})) || []; //그리기
|
|
44
42
|
|
|
45
43
|
renderer({
|
|
46
44
|
context: context,
|
|
47
|
-
offset:
|
|
48
|
-
payload: item
|
|
45
|
+
offset: offset,
|
|
46
|
+
payload: item
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
49
|
});
|
package/dist/index.es.js
CHANGED
|
@@ -4859,21 +4859,19 @@ function renderMain(controller, renderer, container, canvas, context, data) {
|
|
|
4859
4859
|
clearRect(canvas, context); //draw
|
|
4860
4860
|
|
|
4861
4861
|
data.forEach(function (item) {
|
|
4862
|
-
|
|
4863
|
-
var pos = item.position; //위치 변환
|
|
4864
|
-
|
|
4865
|
-
pos.offset = controller.positionToOffset(pos);
|
|
4862
|
+
var _a; // 그리기 대상이면
|
|
4866
4863
|
|
|
4867
|
-
if (item.anchor) {
|
|
4868
|
-
pos.offset.x += item.anchor.x;
|
|
4869
|
-
pos.offset.y += item.anchor.y;
|
|
4870
|
-
} //그리기
|
|
4871
4864
|
|
|
4865
|
+
if (item.visible === undefined || item.visible) {
|
|
4866
|
+
//위치 변환
|
|
4867
|
+
var offset = ((_a = item.position) === null || _a === void 0 ? void 0 : _a.map(function (pos) {
|
|
4868
|
+
return controller.positionToOffset(pos);
|
|
4869
|
+
})) || []; //그리기
|
|
4872
4870
|
|
|
4873
4871
|
renderer({
|
|
4874
4872
|
context: context,
|
|
4875
|
-
offset:
|
|
4876
|
-
payload: item
|
|
4873
|
+
offset: offset,
|
|
4874
|
+
payload: item
|
|
4877
4875
|
});
|
|
4878
4876
|
}
|
|
4879
4877
|
});
|
|
@@ -4950,6 +4948,14 @@ function CanvasMarker(_a) {
|
|
|
4950
4948
|
markerRef.current && controller.updateMarker(markerRef.current, markerOptions); // 렌더링
|
|
4951
4949
|
|
|
4952
4950
|
renderMain(controller, rendererRef.current, containerRef.current, canvasRef.current, contextRef.current, dataRef.current);
|
|
4951
|
+
};
|
|
4952
|
+
|
|
4953
|
+
var handleZoomStart = function () {
|
|
4954
|
+
containerRef.current && (containerRef.current.style.visibility = 'hidden');
|
|
4955
|
+
};
|
|
4956
|
+
|
|
4957
|
+
var handleZoomEnd = function () {
|
|
4958
|
+
containerRef.current && (containerRef.current.style.visibility = '');
|
|
4953
4959
|
}; //initialize
|
|
4954
4960
|
|
|
4955
4961
|
|
|
@@ -4959,17 +4965,19 @@ function CanvasMarker(_a) {
|
|
|
4959
4965
|
if (canvasRef.current && containerRef.current) {
|
|
4960
4966
|
// 리사이즈 처리
|
|
4961
4967
|
resizeObserver = new ResizeObserver(function () {
|
|
4962
|
-
|
|
4963
|
-
|
|
4968
|
+
// 클리어
|
|
4964
4969
|
clearRect(canvasRef.current, contextRef.current); // 스케일링
|
|
4965
4970
|
|
|
4966
4971
|
canvasRef.current && contextRef.current && scaleCanvas(controller, canvasRef.current, contextRef.current); // 렌더링
|
|
4967
4972
|
|
|
4968
4973
|
renderMain(controller, rendererRef.current, containerRef.current, canvasRef.current, contextRef.current, dataRef.current);
|
|
4969
4974
|
});
|
|
4970
|
-
resizeObserver.observe(
|
|
4975
|
+
resizeObserver.observe(controller.mapDivElement); // IDLE 이벤트 등록
|
|
4976
|
+
|
|
4977
|
+
controller.addEventListener('IDLE', handleIdle); // 줌 처리
|
|
4971
4978
|
|
|
4972
|
-
controller.addEventListener('
|
|
4979
|
+
controller.addEventListener('ZOOMSTART', handleZoomStart);
|
|
4980
|
+
controller.addEventListener('ZOOM_CHANGED', handleZoomEnd); // 2d 컨텍스트
|
|
4973
4981
|
|
|
4974
4982
|
contextRef.current = canvasRef.current.getContext('2d'); // 스케일링
|
|
4975
4983
|
|
|
@@ -4981,6 +4989,8 @@ function CanvasMarker(_a) {
|
|
|
4981
4989
|
return function () {
|
|
4982
4990
|
resizeObserver && resizeObserver.disconnect();
|
|
4983
4991
|
controller.removeEventListener('IDLE', handleIdle);
|
|
4992
|
+
controller.removeEventListener('ZOOMSTART', handleZoomStart);
|
|
4993
|
+
controller.removeEventListener('ZOOM_CHANGED', handleZoomEnd);
|
|
4984
4994
|
};
|
|
4985
4995
|
}, []); // data ref
|
|
4986
4996
|
|
package/dist/index.umd.js
CHANGED
|
@@ -4863,21 +4863,19 @@
|
|
|
4863
4863
|
clearRect(canvas, context); //draw
|
|
4864
4864
|
|
|
4865
4865
|
data.forEach(function (item) {
|
|
4866
|
-
|
|
4867
|
-
var pos = item.position; //위치 변환
|
|
4868
|
-
|
|
4869
|
-
pos.offset = controller.positionToOffset(pos);
|
|
4866
|
+
var _a; // 그리기 대상이면
|
|
4870
4867
|
|
|
4871
|
-
if (item.anchor) {
|
|
4872
|
-
pos.offset.x += item.anchor.x;
|
|
4873
|
-
pos.offset.y += item.anchor.y;
|
|
4874
|
-
} //그리기
|
|
4875
4868
|
|
|
4869
|
+
if (item.visible === undefined || item.visible) {
|
|
4870
|
+
//위치 변환
|
|
4871
|
+
var offset = ((_a = item.position) === null || _a === void 0 ? void 0 : _a.map(function (pos) {
|
|
4872
|
+
return controller.positionToOffset(pos);
|
|
4873
|
+
})) || []; //그리기
|
|
4876
4874
|
|
|
4877
4875
|
renderer({
|
|
4878
4876
|
context: context,
|
|
4879
|
-
offset:
|
|
4880
|
-
payload: item
|
|
4877
|
+
offset: offset,
|
|
4878
|
+
payload: item
|
|
4881
4879
|
});
|
|
4882
4880
|
}
|
|
4883
4881
|
});
|
|
@@ -4954,6 +4952,14 @@
|
|
|
4954
4952
|
markerRef.current && controller.updateMarker(markerRef.current, markerOptions); // 렌더링
|
|
4955
4953
|
|
|
4956
4954
|
renderMain(controller, rendererRef.current, containerRef.current, canvasRef.current, contextRef.current, dataRef.current);
|
|
4955
|
+
};
|
|
4956
|
+
|
|
4957
|
+
var handleZoomStart = function () {
|
|
4958
|
+
containerRef.current && (containerRef.current.style.visibility = 'hidden');
|
|
4959
|
+
};
|
|
4960
|
+
|
|
4961
|
+
var handleZoomEnd = function () {
|
|
4962
|
+
containerRef.current && (containerRef.current.style.visibility = '');
|
|
4957
4963
|
}; //initialize
|
|
4958
4964
|
|
|
4959
4965
|
|
|
@@ -4963,17 +4969,19 @@
|
|
|
4963
4969
|
if (canvasRef.current && containerRef.current) {
|
|
4964
4970
|
// 리사이즈 처리
|
|
4965
4971
|
resizeObserver = new ResizeObserver(function () {
|
|
4966
|
-
|
|
4967
|
-
|
|
4972
|
+
// 클리어
|
|
4968
4973
|
clearRect(canvasRef.current, contextRef.current); // 스케일링
|
|
4969
4974
|
|
|
4970
4975
|
canvasRef.current && contextRef.current && scaleCanvas(controller, canvasRef.current, contextRef.current); // 렌더링
|
|
4971
4976
|
|
|
4972
4977
|
renderMain(controller, rendererRef.current, containerRef.current, canvasRef.current, contextRef.current, dataRef.current);
|
|
4973
4978
|
});
|
|
4974
|
-
resizeObserver.observe(
|
|
4979
|
+
resizeObserver.observe(controller.mapDivElement); // IDLE 이벤트 등록
|
|
4980
|
+
|
|
4981
|
+
controller.addEventListener('IDLE', handleIdle); // 줌 처리
|
|
4975
4982
|
|
|
4976
|
-
controller.addEventListener('
|
|
4983
|
+
controller.addEventListener('ZOOMSTART', handleZoomStart);
|
|
4984
|
+
controller.addEventListener('ZOOM_CHANGED', handleZoomEnd); // 2d 컨텍스트
|
|
4977
4985
|
|
|
4978
4986
|
contextRef.current = canvasRef.current.getContext('2d'); // 스케일링
|
|
4979
4987
|
|
|
@@ -4985,6 +4993,8 @@
|
|
|
4985
4993
|
return function () {
|
|
4986
4994
|
resizeObserver && resizeObserver.disconnect();
|
|
4987
4995
|
controller.removeEventListener('IDLE', handleIdle);
|
|
4996
|
+
controller.removeEventListener('ZOOMSTART', handleZoomStart);
|
|
4997
|
+
controller.removeEventListener('ZOOM_CHANGED', handleZoomEnd);
|
|
4988
4998
|
};
|
|
4989
4999
|
}, []); // data ref
|
|
4990
5000
|
|