@mint-ui/map 1.2.0-test.10 → 1.2.0-test.12
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/MintMapController.d.ts +1 -0
- package/dist/components/mint-map/core/MintMapCore.js +1 -2
- package/dist/components/mint-map/core/advanced/woongCanvas/WoongCanvasLayer.d.ts +162 -0
- package/dist/components/mint-map/core/advanced/woongCanvas/{WoongKonvaMarker.js → WoongCanvasLayer.js} +136 -82
- package/dist/components/mint-map/core/advanced/woongCanvas/index.d.ts +2 -2
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/renderer.d.ts +59 -0
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/renderer.js +226 -0
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/types.d.ts +95 -1
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/utils.d.ts +17 -0
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/utils.js +42 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +22 -1
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +1 -0
- package/dist/components/mint-map/google/GoogleMintMapController.js +6 -1
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +1 -0
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +6 -1
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +3 -0
- package/dist/components/mint-map/naver/NaverMintMapController.js +39 -4
- package/dist/index.es.js +458 -83
- package/dist/index.js +4 -2
- package/dist/index.umd.js +460 -83
- package/package.json +1 -1
- package/dist/components/mint-map/core/advanced/woongCanvas/ClusterMarker.d.ts +0 -11
- package/dist/components/mint-map/core/advanced/woongCanvas/WoongKonvaMarker.d.ts +0 -54
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 폴리곤 렌더링 유틸리티
|
|
7
|
+
*
|
|
8
|
+
* 이 파일은 폴리곤 렌더링을 위한 헬퍼 함수와 팩토리 함수를 제공합니다.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 폴리곤 그리기 헬퍼 함수 (도넛 폴리곤 지원)
|
|
13
|
+
*/
|
|
14
|
+
var drawPolygon = function (_a) {
|
|
15
|
+
var ctx = _a.ctx,
|
|
16
|
+
polygonOffsets = _a.polygonOffsets,
|
|
17
|
+
isDonutPolygon = _a.isDonutPolygon,
|
|
18
|
+
fillColor = _a.fillColor,
|
|
19
|
+
strokeColor = _a.strokeColor,
|
|
20
|
+
lineWidth = _a.lineWidth;
|
|
21
|
+
|
|
22
|
+
for (var _i = 0, polygonOffsets_1 = polygonOffsets; _i < polygonOffsets_1.length; _i++) {
|
|
23
|
+
var multiPolygon = polygonOffsets_1[_i];
|
|
24
|
+
|
|
25
|
+
if (isDonutPolygon) {
|
|
26
|
+
ctx.beginPath(); // 1. 외부 폴리곤 그리기
|
|
27
|
+
|
|
28
|
+
if (multiPolygon[0] && multiPolygon[0].length > 0) {
|
|
29
|
+
ctx.moveTo(multiPolygon[0][0][0], multiPolygon[0][0][1]);
|
|
30
|
+
|
|
31
|
+
for (var i = 1; i < multiPolygon[0].length; i++) {
|
|
32
|
+
ctx.lineTo(multiPolygon[0][i][0], multiPolygon[0][i][1]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ctx.closePath();
|
|
36
|
+
} // 2. 내부 폴리곤 (구멍들) 그리기 - 같은 path에 추가
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
for (var j = 1; j < multiPolygon.length; j++) {
|
|
40
|
+
var innerPolygon = multiPolygon[j];
|
|
41
|
+
if (innerPolygon.length === 0) continue;
|
|
42
|
+
ctx.moveTo(innerPolygon[0][0], innerPolygon[0][1]);
|
|
43
|
+
|
|
44
|
+
for (var i = 1; i < innerPolygon.length; i++) {
|
|
45
|
+
ctx.lineTo(innerPolygon[i][0], innerPolygon[i][1]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ctx.closePath();
|
|
49
|
+
} // 3. evenodd fill rule로 구멍 뚫기
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
ctx.fillStyle = fillColor;
|
|
53
|
+
ctx.fill('evenodd'); // 4. 외곽선 그리기
|
|
54
|
+
|
|
55
|
+
ctx.strokeStyle = strokeColor;
|
|
56
|
+
ctx.lineWidth = lineWidth;
|
|
57
|
+
ctx.stroke();
|
|
58
|
+
} else {
|
|
59
|
+
// 일반 폴리곤
|
|
60
|
+
for (var _b = 0, multiPolygon_1 = multiPolygon; _b < multiPolygon_1.length; _b++) {
|
|
61
|
+
var polygonGroup = multiPolygon_1[_b];
|
|
62
|
+
if (!polygonGroup.length) continue;
|
|
63
|
+
ctx.beginPath();
|
|
64
|
+
var firstPoint = polygonGroup[0];
|
|
65
|
+
ctx.moveTo(firstPoint[0], firstPoint[1]);
|
|
66
|
+
|
|
67
|
+
for (var i = 1; i < polygonGroup.length; i++) {
|
|
68
|
+
var point = polygonGroup[i];
|
|
69
|
+
ctx.lineTo(point[0], point[1]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ctx.closePath();
|
|
73
|
+
ctx.fillStyle = fillColor;
|
|
74
|
+
ctx.strokeStyle = strokeColor;
|
|
75
|
+
ctx.lineWidth = lineWidth;
|
|
76
|
+
ctx.fill();
|
|
77
|
+
ctx.stroke();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 폴리곤 Base 렌더링 함수
|
|
84
|
+
*
|
|
85
|
+
* @param baseFillColor 기본 폴리곤 채우기 색상
|
|
86
|
+
* @param baseStrokeColor 기본 폴리곤 테두리 색상
|
|
87
|
+
* @param baseLineWidth 기본 폴리곤 테두리 두께
|
|
88
|
+
* @returns Base Layer 렌더링 함수
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* const renderBase = renderPolygonBase(
|
|
92
|
+
* 'rgba(255, 100, 100, 0.5)',
|
|
93
|
+
* 'rgba(200, 50, 50, 0.8)',
|
|
94
|
+
* 2
|
|
95
|
+
* );
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
var renderPolygonBase = function (baseFillColor, baseStrokeColor, baseLineWidth) {
|
|
99
|
+
return function (_a) {
|
|
100
|
+
var ctx = _a.ctx,
|
|
101
|
+
items = _a.items,
|
|
102
|
+
selectedIds = _a.selectedIds,
|
|
103
|
+
utils = _a.utils;
|
|
104
|
+
|
|
105
|
+
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
|
106
|
+
var item = items_1[_i]; // 선택된 항목은 Event Layer에서 그림
|
|
107
|
+
|
|
108
|
+
if (selectedIds.has(item.id)) continue;
|
|
109
|
+
if (!item.paths) continue;
|
|
110
|
+
var polygonOffsets = utils.getOrComputePolygonOffsets(item);
|
|
111
|
+
if (!polygonOffsets) continue;
|
|
112
|
+
drawPolygon({
|
|
113
|
+
ctx: ctx,
|
|
114
|
+
polygonOffsets: polygonOffsets,
|
|
115
|
+
isDonutPolygon: item.isDonutPolygon || false,
|
|
116
|
+
fillColor: baseFillColor,
|
|
117
|
+
strokeColor: baseStrokeColor,
|
|
118
|
+
lineWidth: baseLineWidth
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* 폴리곤 Event 렌더링 함수
|
|
125
|
+
*
|
|
126
|
+
* @param selectedFillColor 선택된 폴리곤 채우기 색상
|
|
127
|
+
* @param selectedStrokeColor 선택된 폴리곤 테두리 색상
|
|
128
|
+
* @param selectedLineWidth 선택된 폴리곤 테두리 두께
|
|
129
|
+
* @param activeFillColor 마지막 선택된 폴리곤 채우기 색상 (선택, 기본값: selectedFillColor)
|
|
130
|
+
* @param activeStrokeColor 마지막 선택된 폴리곤 테두리 색상 (선택, 기본값: selectedStrokeColor)
|
|
131
|
+
* @param activeLineWidth 마지막 선택된 폴리곤 테두리 두께 (선택, 기본값: selectedLineWidth)
|
|
132
|
+
* @param hoveredFillColor Hover 시 폴리곤 채우기 색상 (선택, 기본값: selectedFillColor)
|
|
133
|
+
* @param hoveredStrokeColor Hover 시 폴리곤 테두리 색상 (선택, 기본값: selectedStrokeColor)
|
|
134
|
+
* @param hoveredLineWidth Hover 시 폴리곤 테두리 두께 (선택, 기본값: selectedLineWidth)
|
|
135
|
+
* @returns Event Layer 렌더링 함수
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* const renderEvent = renderPolygonEvent(
|
|
139
|
+
* 'rgba(255, 193, 7, 0.7)',
|
|
140
|
+
* 'rgba(255, 152, 0, 1)',
|
|
141
|
+
* 4,
|
|
142
|
+
* 'rgba(255, 0, 0, 0.8)',
|
|
143
|
+
* undefined,
|
|
144
|
+
* undefined,
|
|
145
|
+
* 'rgba(100, 150, 255, 0.8)'
|
|
146
|
+
* );
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
var renderPolygonEvent = function (selectedFillColor, selectedStrokeColor, selectedLineWidth, activeFillColor, activeStrokeColor, activeLineWidth, hoveredFillColor, hoveredStrokeColor, hoveredLineWidth) {
|
|
150
|
+
// 기본값 설정 (selected 기준)
|
|
151
|
+
var _activeFillColor = activeFillColor || selectedFillColor;
|
|
152
|
+
|
|
153
|
+
var _activeStrokeColor = activeStrokeColor || selectedStrokeColor;
|
|
154
|
+
|
|
155
|
+
var _activeLineWidth = activeLineWidth || selectedLineWidth;
|
|
156
|
+
|
|
157
|
+
var _hoveredFillColor = hoveredFillColor || selectedFillColor;
|
|
158
|
+
|
|
159
|
+
var _hoveredStrokeColor = hoveredStrokeColor || selectedStrokeColor;
|
|
160
|
+
|
|
161
|
+
var _hoveredLineWidth = hoveredLineWidth || selectedLineWidth;
|
|
162
|
+
|
|
163
|
+
return function (_a) {
|
|
164
|
+
var ctx = _a.ctx,
|
|
165
|
+
hoveredItem = _a.hoveredItem,
|
|
166
|
+
utils = _a.utils,
|
|
167
|
+
selectedItems = _a.selectedItems,
|
|
168
|
+
selectedItem = _a.selectedItem; // 1. 선택된 항목들 그리기 (마지막 선택 항목과 호버된 항목 제외)
|
|
169
|
+
|
|
170
|
+
if (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) {
|
|
171
|
+
for (var _i = 0, selectedItems_1 = selectedItems; _i < selectedItems_1.length; _i++) {
|
|
172
|
+
var item = selectedItems_1[_i]; // 마지막 선택 항목과 호버된 항목은 나중에 따로 그림
|
|
173
|
+
|
|
174
|
+
if (item.id === (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) || (hoveredItem === null || hoveredItem === void 0 ? void 0 : hoveredItem.id) === item.id) continue;
|
|
175
|
+
if (!item.paths) continue;
|
|
176
|
+
var polygonOffsets = utils.getOrComputePolygonOffsets(item);
|
|
177
|
+
if (!polygonOffsets) continue;
|
|
178
|
+
drawPolygon({
|
|
179
|
+
ctx: ctx,
|
|
180
|
+
polygonOffsets: polygonOffsets,
|
|
181
|
+
isDonutPolygon: item.isDonutPolygon || false,
|
|
182
|
+
fillColor: selectedFillColor,
|
|
183
|
+
strokeColor: selectedStrokeColor,
|
|
184
|
+
lineWidth: selectedLineWidth
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
} // 2. 마지막 선택된 항목 그리기 (호버되지 않은 경우)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
if ((selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.paths) && (hoveredItem === null || hoveredItem === void 0 ? void 0 : hoveredItem.id) !== selectedItem.id) {
|
|
191
|
+
var polygonOffsets = utils.getOrComputePolygonOffsets(selectedItem);
|
|
192
|
+
|
|
193
|
+
if (polygonOffsets) {
|
|
194
|
+
drawPolygon({
|
|
195
|
+
ctx: ctx,
|
|
196
|
+
polygonOffsets: polygonOffsets,
|
|
197
|
+
isDonutPolygon: selectedItem.isDonutPolygon || false,
|
|
198
|
+
fillColor: _activeFillColor,
|
|
199
|
+
strokeColor: _activeStrokeColor,
|
|
200
|
+
lineWidth: _activeLineWidth
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
} // 3. 호버된 항목 그리기 (가장 위에 표시)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if (hoveredItem === null || hoveredItem === void 0 ? void 0 : hoveredItem.paths) {
|
|
207
|
+
var polygonOffsets = utils.getOrComputePolygonOffsets(hoveredItem);
|
|
208
|
+
if (!polygonOffsets) return;
|
|
209
|
+
var isSelected = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.some(function (item) {
|
|
210
|
+
return item.id === hoveredItem.id;
|
|
211
|
+
});
|
|
212
|
+
drawPolygon({
|
|
213
|
+
ctx: ctx,
|
|
214
|
+
polygonOffsets: polygonOffsets,
|
|
215
|
+
isDonutPolygon: hoveredItem.isDonutPolygon || false,
|
|
216
|
+
fillColor: isSelected ? _activeFillColor : _hoveredFillColor,
|
|
217
|
+
strokeColor: isSelected ? _activeStrokeColor : _hoveredStrokeColor,
|
|
218
|
+
lineWidth: isSelected ? _activeLineWidth : _hoveredLineWidth
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
exports.drawPolygon = drawPolygon;
|
|
225
|
+
exports.renderPolygonBase = renderPolygonBase;
|
|
226
|
+
exports.renderPolygonEvent = renderPolygonEvent;
|
|
@@ -40,10 +40,104 @@ export interface KonvaCanvasMarkerOption {
|
|
|
40
40
|
*/
|
|
41
41
|
export declare type KonvaCanvasMarkerData<T = {}> = T & KonvaCanvasMarkerOption;
|
|
42
42
|
/**
|
|
43
|
-
* 렌더링 유틸리티 함수들
|
|
43
|
+
* 🛠️ 렌더링 유틸리티 함수들
|
|
44
|
+
*
|
|
45
|
+
* WoongCanvasLayer가 제공하는 헬퍼 함수 모음입니다.
|
|
46
|
+
* 커스텀 렌더링 함수 내에서 좌표 변환 시 사용하세요.
|
|
47
|
+
*
|
|
48
|
+
* ## 주요 기능
|
|
49
|
+
* - **자동 캐싱**: 좌표 변환 결과를 LRU 캐시에 저장 (성능 최적화)
|
|
50
|
+
* - **지도 좌표 → 화면 좌표**: 위경도를 픽셀 좌표로 자동 변환
|
|
51
|
+
* - **null 안전성**: 변환 실패 시 null 반환 (안전한 예외 처리)
|
|
52
|
+
*
|
|
53
|
+
* @template T 마커/폴리곤 데이터의 추가 속성 타입
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // 마커 렌더링 예시
|
|
57
|
+
* const renderBase = ({ ctx, items, utils }) => {
|
|
58
|
+
* for (const item of items) {
|
|
59
|
+
* const offset = utils.getOrComputeMarkerOffset(item);
|
|
60
|
+
* if (!offset) continue; // 변환 실패 시 스킵
|
|
61
|
+
*
|
|
62
|
+
* ctx.fillRect(offset.x, offset.y, 50, 50);
|
|
63
|
+
* }
|
|
64
|
+
* };
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // 폴리곤 렌더링 예시
|
|
68
|
+
* const renderBase = ({ ctx, items, utils }) => {
|
|
69
|
+
* for (const item of items) {
|
|
70
|
+
* const offsets = utils.getOrComputePolygonOffsets(item);
|
|
71
|
+
* if (!offsets) continue;
|
|
72
|
+
*
|
|
73
|
+
* for (const multiPolygon of offsets) {
|
|
74
|
+
* for (const polygon of multiPolygon) {
|
|
75
|
+
* ctx.beginPath();
|
|
76
|
+
* ctx.moveTo(polygon[0][0], polygon[0][1]);
|
|
77
|
+
* for (let i = 1; i < polygon.length; i++) {
|
|
78
|
+
* ctx.lineTo(polygon[i][0], polygon[i][1]);
|
|
79
|
+
* }
|
|
80
|
+
* ctx.closePath();
|
|
81
|
+
* ctx.fill();
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
* };
|
|
44
86
|
*/
|
|
45
87
|
export interface RenderUtils<T> {
|
|
88
|
+
/**
|
|
89
|
+
* 폴리곤의 위경도 좌표를 화면 픽셀 좌표로 변환합니다.
|
|
90
|
+
*
|
|
91
|
+
* - **자동 캐싱**: 동일한 폴리곤은 캐시에서 즉시 반환 (성능 최적화)
|
|
92
|
+
* - **MultiPolygon 지원**: GeoJSON MultiPolygon 형식 지원
|
|
93
|
+
* - **Donut Polygon 지원**: 구멍이 있는 폴리곤 지원
|
|
94
|
+
*
|
|
95
|
+
* @param polygonData 폴리곤 데이터 (paths 필드 필수)
|
|
96
|
+
* @returns 변환된 픽셀 좌표 배열 (4차원 배열) 또는 null (변환 실패 시)
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* const offsets = utils.getOrComputePolygonOffsets(polygonItem);
|
|
100
|
+
* if (!offsets) return; // 변환 실패
|
|
101
|
+
*
|
|
102
|
+
* // offsets 구조: [MultiPolygon][Polygon][Point][x/y]
|
|
103
|
+
* for (const multiPolygon of offsets) {
|
|
104
|
+
* for (const polygon of multiPolygon) {
|
|
105
|
+
* ctx.beginPath();
|
|
106
|
+
* ctx.moveTo(polygon[0][0], polygon[0][1]);
|
|
107
|
+
* for (let i = 1; i < polygon.length; i++) {
|
|
108
|
+
* ctx.lineTo(polygon[i][0], polygon[i][1]);
|
|
109
|
+
* }
|
|
110
|
+
* ctx.closePath();
|
|
111
|
+
* ctx.fill();
|
|
112
|
+
* }
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
46
115
|
getOrComputePolygonOffsets: (polygonData: KonvaCanvasMarkerData<T>) => number[][][][] | null;
|
|
116
|
+
/**
|
|
117
|
+
* 마커의 위경도 좌표를 화면 픽셀 좌표로 변환합니다.
|
|
118
|
+
*
|
|
119
|
+
* - **자동 캐싱**: 동일한 마커는 캐시에서 즉시 반환 (성능 최적화)
|
|
120
|
+
* - **중심점 기준**: 반환된 좌표는 마커의 중심점 (x, y)
|
|
121
|
+
*
|
|
122
|
+
* @param markerData 마커 데이터 (position 필드 필수)
|
|
123
|
+
* @returns 변환된 픽셀 좌표 { x, y } 또는 null (변환 실패 시)
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* const offset = utils.getOrComputeMarkerOffset(markerItem);
|
|
127
|
+
* if (!offset) return; // 변환 실패
|
|
128
|
+
*
|
|
129
|
+
* // offset.x, offset.y는 화면 픽셀 좌표
|
|
130
|
+
* const boxWidth = markerItem.boxWidth || 60;
|
|
131
|
+
* const boxHeight = markerItem.boxHeight || 75;
|
|
132
|
+
*
|
|
133
|
+
* // 중앙 정렬, 하단 기준으로 그리기
|
|
134
|
+
* ctx.fillRect(
|
|
135
|
+
* offset.x - boxWidth / 2,
|
|
136
|
+
* offset.y - boxHeight,
|
|
137
|
+
* boxWidth,
|
|
138
|
+
* boxHeight
|
|
139
|
+
* );
|
|
140
|
+
*/
|
|
47
141
|
getOrComputeMarkerOffset: (markerData: KonvaCanvasMarkerData<T>) => Offset | null;
|
|
48
142
|
}
|
|
49
143
|
/**
|
|
@@ -29,3 +29,20 @@ export declare const isPointInPolygonData: (clickedOffset: Offset, polygonData:
|
|
|
29
29
|
* 마커 히트 테스트
|
|
30
30
|
*/
|
|
31
31
|
export declare const isPointInMarkerData: (clickedOffset: Offset, markerData: KonvaCanvasMarkerData<any>, getMarkerOffset: (data: KonvaCanvasMarkerData<any>) => Offset | null) => boolean;
|
|
32
|
+
export declare const hexToRgba: (hexColor: string, alpha?: number) => string;
|
|
33
|
+
/**
|
|
34
|
+
* 텍스트 박스의 너비를 계산합니다.
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} params - 파라미터 객체
|
|
37
|
+
* @param {string} params.text - 측정할 텍스트
|
|
38
|
+
* @param {string} params.fontConfig - 폰트 설정 (예: 'bold 16px Arial')
|
|
39
|
+
* @param {number} params.padding - 텍스트 박스에 적용할 패딩 값
|
|
40
|
+
* @param {number} params.minWidth - 최소 너비
|
|
41
|
+
* @returns {number} 계산된 텍스트 박스의 너비
|
|
42
|
+
*/
|
|
43
|
+
export declare const calculateTextBoxWidth: ({ text, fontConfig, padding, minWidth, }: {
|
|
44
|
+
text: string;
|
|
45
|
+
fontConfig: string;
|
|
46
|
+
padding: number;
|
|
47
|
+
minWidth: number;
|
|
48
|
+
}) => number;
|
|
@@ -156,9 +156,51 @@ var isPointInMarkerData = function (clickedOffset, markerData, getMarkerOffset)
|
|
|
156
156
|
var y = markerOffset.y - boxHeight - tailHeight;
|
|
157
157
|
return clickedOffset.x >= x && clickedOffset.x <= x + boxWidth && clickedOffset.y >= y && clickedOffset.y <= y + boxHeight;
|
|
158
158
|
};
|
|
159
|
+
var hexToRgba = function (hexColor, alpha) {
|
|
160
|
+
if (alpha === void 0) {
|
|
161
|
+
alpha = 1;
|
|
162
|
+
} // NOTE: 입력된 hexColor에서 "#" 제거
|
|
159
163
|
|
|
164
|
+
|
|
165
|
+
var hex = hexColor.replace('#', ''); // NOTE: 6자리일 경우 알파 값은 사용자가 제공한 alpha 값으로 설정
|
|
166
|
+
|
|
167
|
+
if (hex.length === 6) {
|
|
168
|
+
var r = parseInt(hex.substring(0, 2), 16);
|
|
169
|
+
var g = parseInt(hex.substring(2, 4), 16);
|
|
170
|
+
var b = parseInt(hex.substring(4, 6), 16);
|
|
171
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
throw new Error('Invalid hex color format');
|
|
175
|
+
};
|
|
176
|
+
var tempCanvas = document.createElement('canvas');
|
|
177
|
+
var tempCtx = tempCanvas.getContext('2d');
|
|
178
|
+
/**
|
|
179
|
+
* 텍스트 박스의 너비를 계산합니다.
|
|
180
|
+
*
|
|
181
|
+
* @param {Object} params - 파라미터 객체
|
|
182
|
+
* @param {string} params.text - 측정할 텍스트
|
|
183
|
+
* @param {string} params.fontConfig - 폰트 설정 (예: 'bold 16px Arial')
|
|
184
|
+
* @param {number} params.padding - 텍스트 박스에 적용할 패딩 값
|
|
185
|
+
* @param {number} params.minWidth - 최소 너비
|
|
186
|
+
* @returns {number} 계산된 텍스트 박스의 너비
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
var calculateTextBoxWidth = function (_a) {
|
|
190
|
+
var text = _a.text,
|
|
191
|
+
fontConfig = _a.fontConfig,
|
|
192
|
+
padding = _a.padding,
|
|
193
|
+
minWidth = _a.minWidth;
|
|
194
|
+
if (!tempCtx) return 0;
|
|
195
|
+
tempCtx.font = fontConfig;
|
|
196
|
+
var textWidth = tempCtx.measureText(text).width;
|
|
197
|
+
return Math.max(minWidth, textWidth + padding);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
exports.calculateTextBoxWidth = calculateTextBoxWidth;
|
|
160
201
|
exports.computeMarkerOffset = computeMarkerOffset;
|
|
161
202
|
exports.computePolygonOffsets = computePolygonOffsets;
|
|
203
|
+
exports.hexToRgba = hexToRgba;
|
|
162
204
|
exports.isPointInMarkerData = isPointInMarkerData;
|
|
163
205
|
exports.isPointInPolygon = isPointInPolygon;
|
|
164
206
|
exports.isPointInPolygonData = isPointInPolygonData;
|
|
@@ -172,7 +172,7 @@ function MapMarkerWrapper(_a) {
|
|
|
172
172
|
var onMouseOverHandler = function (e) {
|
|
173
173
|
var _a;
|
|
174
174
|
|
|
175
|
-
var marker = markerRef.current;
|
|
175
|
+
var marker = markerRef.current;
|
|
176
176
|
|
|
177
177
|
if (marker) {
|
|
178
178
|
var mouseOverHandler = (_a = options === null || options === void 0 ? void 0 : options.event) === null || _a === void 0 ? void 0 : _a.get('mouseover');
|
|
@@ -185,6 +185,25 @@ function MapMarkerWrapper(_a) {
|
|
|
185
185
|
|
|
186
186
|
next && topOnHover && controller.markerToTheTop(marker);
|
|
187
187
|
}
|
|
188
|
+
}; // 20251014 | 장한별 | mouseleave 이벤트 추가, 마우스가 마커 위에서 떠날 때 원래 zindex 를 복구하기 위함
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
var onMouseLeaveHandler = function (e) {
|
|
192
|
+
var _a;
|
|
193
|
+
|
|
194
|
+
var marker = markerRef.current;
|
|
195
|
+
|
|
196
|
+
if (marker) {
|
|
197
|
+
var mouseOutHandler = (_a = options === null || options === void 0 ? void 0 : options.event) === null || _a === void 0 ? void 0 : _a.get('mouseout');
|
|
198
|
+
var next = true;
|
|
199
|
+
|
|
200
|
+
if (mouseOutHandler) {
|
|
201
|
+
var hasNext = mouseOutHandler(e);
|
|
202
|
+
hasNext !== undefined && (next = hasNext);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
next && topOnHover && controller.restoreMarkerZIndex(marker);
|
|
206
|
+
}
|
|
188
207
|
}; //create object
|
|
189
208
|
|
|
190
209
|
|
|
@@ -202,10 +221,12 @@ function MapMarkerWrapper(_a) {
|
|
|
202
221
|
}); //드래그 여부 초기화를 먼저 수행하기 위해 capture : true 처리
|
|
203
222
|
|
|
204
223
|
divElement.addEventListener('mouseover', onMouseOverHandler);
|
|
224
|
+
divElement.addEventListener('mouseleave', onMouseLeaveHandler);
|
|
205
225
|
return function () {
|
|
206
226
|
divElement.removeEventListener('click', onClickHandler);
|
|
207
227
|
divElement.removeEventListener('mousedown', onMousedownHandler);
|
|
208
228
|
divElement.removeEventListener('mouseover', onMouseOverHandler);
|
|
229
|
+
divElement.removeEventListener('mouseleave', onMouseLeaveHandler);
|
|
209
230
|
|
|
210
231
|
if (markerRef.current) {
|
|
211
232
|
controller.clearDrawable(markerRef.current);
|
|
@@ -28,6 +28,7 @@ export declare class GoogleMintMapController extends MintMapController {
|
|
|
28
28
|
private getMaxZIndex;
|
|
29
29
|
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
30
30
|
markerToTheTop(marker: Marker): void;
|
|
31
|
+
restoreMarkerZIndex(marker: Marker): void;
|
|
31
32
|
clearDrawable(drawable: Drawable): boolean;
|
|
32
33
|
private dragged;
|
|
33
34
|
isMapDragged(): boolean;
|
|
@@ -20,8 +20,9 @@ var polygon = require('../core/util/polygon.js');
|
|
|
20
20
|
require('../naver/NaverMintMapController.js');
|
|
21
21
|
require('../core/advanced/canvas/CanvasMarkerClaude.js');
|
|
22
22
|
require('../core/advanced/MapLoadingComponents.js');
|
|
23
|
-
require('../core/advanced/woongCanvas/
|
|
23
|
+
require('../core/advanced/woongCanvas/WoongCanvasLayer.js');
|
|
24
24
|
require('../core/advanced/woongCanvas/shared/types.js');
|
|
25
|
+
require('../core/advanced/woongCanvas/shared/utils.js');
|
|
25
26
|
require('../core/advanced/woongCanvas/shared/context.js');
|
|
26
27
|
require('../core/advanced/woongCanvas/shared/performance.js');
|
|
27
28
|
require('../core/wrapper/MapControlWrapper.js');
|
|
@@ -340,6 +341,10 @@ function (_super) {
|
|
|
340
341
|
}
|
|
341
342
|
};
|
|
342
343
|
|
|
344
|
+
GoogleMintMapController.prototype.restoreMarkerZIndex = function (marker) {// Google Maps에서는 restoreMarkerZIndex 기능을 지원하지 않습니다.
|
|
345
|
+
// 이 기능은 Naver Maps에서만 사용 가능합니다.
|
|
346
|
+
};
|
|
347
|
+
|
|
343
348
|
GoogleMintMapController.prototype.clearDrawable = function (drawable) {
|
|
344
349
|
if (drawable && drawable.native) {
|
|
345
350
|
if (drawable.native instanceof google.maps.Marker || drawable.native instanceof google.maps.Polygon || drawable.native instanceof google.maps.Polyline) {
|
|
@@ -31,6 +31,7 @@ export declare class KakaoMintMapController extends MintMapController {
|
|
|
31
31
|
private getMaxZIndex;
|
|
32
32
|
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
33
33
|
markerToTheTop(marker: Marker): void;
|
|
34
|
+
restoreMarkerZIndex(marker: Marker): void;
|
|
34
35
|
clearDrawable(drawable: Drawable): boolean;
|
|
35
36
|
private dragged;
|
|
36
37
|
isMapDragged(): boolean;
|
|
@@ -21,8 +21,9 @@ var polygon = require('../core/util/polygon.js');
|
|
|
21
21
|
require('../naver/NaverMintMapController.js');
|
|
22
22
|
require('../core/advanced/canvas/CanvasMarkerClaude.js');
|
|
23
23
|
require('../core/advanced/MapLoadingComponents.js');
|
|
24
|
-
require('../core/advanced/woongCanvas/
|
|
24
|
+
require('../core/advanced/woongCanvas/WoongCanvasLayer.js');
|
|
25
25
|
require('../core/advanced/woongCanvas/shared/types.js');
|
|
26
|
+
require('../core/advanced/woongCanvas/shared/utils.js');
|
|
26
27
|
require('../core/advanced/woongCanvas/shared/context.js');
|
|
27
28
|
require('../core/advanced/woongCanvas/shared/performance.js');
|
|
28
29
|
require('../core/wrapper/MapControlWrapper.js');
|
|
@@ -348,6 +349,10 @@ function (_super) {
|
|
|
348
349
|
}
|
|
349
350
|
};
|
|
350
351
|
|
|
352
|
+
KakaoMintMapController.prototype.restoreMarkerZIndex = function (marker) {// Kakao Maps에서는 restoreMarkerZIndex 기능을 지원하지 않습니다.
|
|
353
|
+
// 이 기능은 Naver Maps에서만 사용 가능합니다.
|
|
354
|
+
};
|
|
355
|
+
|
|
351
356
|
KakaoMintMapController.prototype.clearDrawable = function (drawable) {
|
|
352
357
|
var _this = this;
|
|
353
358
|
|
|
@@ -27,9 +27,12 @@ export declare class NaverMintMapController extends MintMapController {
|
|
|
27
27
|
createMarker(marker: Marker): void;
|
|
28
28
|
updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
29
29
|
private markerMaxZIndex;
|
|
30
|
+
private markerOriginalZIndex;
|
|
30
31
|
private getMaxZIndex;
|
|
32
|
+
private getCurrentZIndex;
|
|
31
33
|
setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
32
34
|
markerToTheTop(marker: Marker): void;
|
|
35
|
+
restoreMarkerZIndex(marker: Marker): void;
|
|
33
36
|
clearDrawable(drawable: Drawable): boolean;
|
|
34
37
|
private dragged;
|
|
35
38
|
isMapDragged(): boolean;
|
|
@@ -20,8 +20,9 @@ require('../core/util/geo.js');
|
|
|
20
20
|
var polygon = require('../core/util/polygon.js');
|
|
21
21
|
require('../core/advanced/canvas/CanvasMarkerClaude.js');
|
|
22
22
|
require('../core/advanced/MapLoadingComponents.js');
|
|
23
|
-
require('../core/advanced/woongCanvas/
|
|
23
|
+
require('../core/advanced/woongCanvas/WoongCanvasLayer.js');
|
|
24
24
|
require('../core/advanced/woongCanvas/shared/types.js');
|
|
25
|
+
require('../core/advanced/woongCanvas/shared/utils.js');
|
|
25
26
|
require('../core/advanced/woongCanvas/shared/context.js');
|
|
26
27
|
require('../core/advanced/woongCanvas/shared/performance.js');
|
|
27
28
|
require('../core/wrapper/MapControlWrapper.js');
|
|
@@ -340,20 +341,54 @@ function (_super) {
|
|
|
340
341
|
}
|
|
341
342
|
};
|
|
342
343
|
|
|
343
|
-
NaverMintMapController.prototype.
|
|
344
|
+
NaverMintMapController.prototype.getCurrentZIndex = function (marker) {
|
|
344
345
|
if (this.map && marker.element && marker.element instanceof HTMLElement) {
|
|
345
346
|
var parent_1 = marker.element.parentElement;
|
|
346
347
|
|
|
347
|
-
if (parent_1) {
|
|
348
|
-
|
|
348
|
+
if (parent_1 && parent_1.style.zIndex) {
|
|
349
|
+
var zIndex = Number(parent_1.style.zIndex);
|
|
350
|
+
return isNaN(zIndex) ? undefined : zIndex;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return undefined;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
NaverMintMapController.prototype.setMarkerZIndex = function (marker, zIndex) {
|
|
358
|
+
if (this.map && marker.element && marker.element instanceof HTMLElement) {
|
|
359
|
+
var parent_2 = marker.element.parentElement;
|
|
360
|
+
|
|
361
|
+
if (parent_2) {
|
|
362
|
+
parent_2.style.zIndex = String(zIndex);
|
|
349
363
|
}
|
|
350
364
|
}
|
|
351
365
|
};
|
|
352
366
|
|
|
353
367
|
NaverMintMapController.prototype.markerToTheTop = function (marker) {
|
|
368
|
+
// 이미 최상위로 올라간 상태면 (원래 zIndex가 이미 저장됨) 중복 실행 방지
|
|
369
|
+
if (this.markerOriginalZIndex !== undefined) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
var currentZIndex = this.getCurrentZIndex(marker); // undefined면 null로 저장 (원래 zIndex가 없었음을 표시)
|
|
374
|
+
|
|
375
|
+
this.markerOriginalZIndex = currentZIndex !== undefined ? currentZIndex : null;
|
|
354
376
|
this.setMarkerZIndex(marker, this.getMaxZIndex(1));
|
|
355
377
|
};
|
|
356
378
|
|
|
379
|
+
NaverMintMapController.prototype.restoreMarkerZIndex = function (marker) {
|
|
380
|
+
if (this.markerOriginalZIndex !== undefined) {
|
|
381
|
+
if (this.markerOriginalZIndex === null) {
|
|
382
|
+
// 원래 zIndex가 없었으면 제거 (또는 초기값 0으로)
|
|
383
|
+
this.setMarkerZIndex(marker, 0);
|
|
384
|
+
} else {
|
|
385
|
+
this.setMarkerZIndex(marker, this.markerOriginalZIndex);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
this.markerOriginalZIndex = undefined;
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
|
|
357
392
|
NaverMintMapController.prototype.clearDrawable = function (drawable) {
|
|
358
393
|
var _a;
|
|
359
394
|
|