@mint-ui/map 1.2.0-test.51 → 1.2.0-test.52
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/CanvasPolygonLayer/CanvasPolygonLayer.d.ts +26 -18
- package/dist/components/mint-map/core/advanced/CanvasPolygonLayer/renderer.d.ts +9 -4
- package/dist/components/mint-map/core/advanced/CanvasPolygonLayer/renderer.js +23 -16
- package/dist/index.es.js +23 -16
- package/dist/index.umd.js +23 -16
- package/package.json +1 -1
|
@@ -54,29 +54,36 @@ export interface PolygonStyleObject {
|
|
|
54
54
|
* 폴리곤 스타일 커스터마이징 함수 타입
|
|
55
55
|
*
|
|
56
56
|
* item 데이터와 상태 정보를 기반으로 자유롭게 스타일을 커스터마이징할 수 있습니다.
|
|
57
|
+
* 스타일을 반환하지 않거나 null/undefined를 반환하면 해당 폴리곤을 그리지 않습니다.
|
|
57
58
|
*
|
|
58
59
|
* @param item 폴리곤 데이터
|
|
59
60
|
* @param context 선택/호버/활성 상태 정보
|
|
60
|
-
* @
|
|
61
|
-
* @returns 커스터마이징된 폴리곤 스타일
|
|
61
|
+
* @returns 커스터마이징된 폴리곤 스타일 (반환하지 않거나 null/undefined면 그리지 않음)
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* ```typescript
|
|
65
|
-
* customStyle={(item, context
|
|
65
|
+
* customStyle={(item, context) => {
|
|
66
66
|
* // item의 속성에 따라 동적으로 스타일 결정
|
|
67
67
|
* if (item.someProperty > 100) {
|
|
68
68
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
69
69
|
* }
|
|
70
70
|
*
|
|
71
|
-
* //
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
71
|
+
* // 상태 정보를 기반으로 스타일 결정
|
|
72
|
+
* if (context.isActive) {
|
|
73
|
+
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
74
|
+
* }
|
|
75
|
+
* if (context.isHovered) {
|
|
76
|
+
* return { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 };
|
|
77
|
+
* }
|
|
78
|
+
* if (context.isSelected) {
|
|
79
|
+
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* // 아무것도 반환하지 않으면 그리지 않음 (return null 또는 return undefined도 가능)
|
|
76
83
|
* }}
|
|
77
84
|
* ```
|
|
78
85
|
*/
|
|
79
|
-
export declare type PolygonStyleCustomizer<T> = (item: CanvasData<T>, context: PolygonStyleContext
|
|
86
|
+
export declare type PolygonStyleCustomizer<T> = (item: CanvasData<T>, context: PolygonStyleContext) => PolygonStyle | null | undefined;
|
|
80
87
|
/**
|
|
81
88
|
* 공통 Props (모든 방식 공통)
|
|
82
89
|
*/
|
|
@@ -135,7 +142,7 @@ interface CanvasPolygonLayerPropsWithIndividualStyles<T> extends CanvasPolygonLa
|
|
|
135
142
|
customStyle?: never;
|
|
136
143
|
}
|
|
137
144
|
/**
|
|
138
|
-
* 객체 Props 방식
|
|
145
|
+
* 객체 Props 방식
|
|
139
146
|
*
|
|
140
147
|
* renderStyle 객체가 있으면 자동으로 객체 방식으로 인식됩니다.
|
|
141
148
|
* 상태별 스타일을 정의하면 개별 props 방식과 동일한 알고리즘으로 적용됩니다.
|
|
@@ -148,10 +155,6 @@ interface CanvasPolygonLayerPropsWithIndividualStyles<T> extends CanvasPolygonLa
|
|
|
148
155
|
* active: { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 },
|
|
149
156
|
* hovered: { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 }
|
|
150
157
|
* }}
|
|
151
|
-
* customStyle={(item, context, defaultStyle) => {
|
|
152
|
-
* // 기본 스타일을 기반으로 추가 커스터마이징
|
|
153
|
-
* return { ...defaultStyle, fillColor: item.someProperty > 100 ? 'red' : defaultStyle.fillColor };
|
|
154
|
-
* }}
|
|
155
158
|
* ```
|
|
156
159
|
*/
|
|
157
160
|
interface CanvasPolygonLayerPropsWithObjectStyle<T> extends CanvasPolygonLayerBaseProps<T> {
|
|
@@ -181,10 +184,11 @@ interface CanvasPolygonLayerPropsWithObjectStyle<T> extends CanvasPolygonLayerBa
|
|
|
181
184
|
*
|
|
182
185
|
* customStyle 함수가 있으면 자동으로 함수 방식으로 인식됩니다.
|
|
183
186
|
* item 데이터와 상태 정보를 기반으로 자유롭게 스타일을 커스터마이징할 수 있습니다.
|
|
187
|
+
* 스타일을 반환하지 않거나 null/undefined를 반환하면 해당 폴리곤을 그리지 않습니다.
|
|
184
188
|
*
|
|
185
189
|
* @example
|
|
186
190
|
* ```typescript
|
|
187
|
-
* customStyle={(item, context
|
|
191
|
+
* customStyle={(item, context) => {
|
|
188
192
|
* // item의 속성에 따라 동적으로 스타일 결정
|
|
189
193
|
* if (item.someProperty > 100) {
|
|
190
194
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
@@ -201,8 +205,7 @@ interface CanvasPolygonLayerPropsWithObjectStyle<T> extends CanvasPolygonLayerBa
|
|
|
201
205
|
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
202
206
|
* }
|
|
203
207
|
*
|
|
204
|
-
* //
|
|
205
|
-
* return { fillColor: 'gray', strokeColor: 'black', lineWidth: 2 };
|
|
208
|
+
* // 아무것도 반환하지 않으면 그리지 않음 (return null 또는 return undefined도 가능)
|
|
206
209
|
* }}
|
|
207
210
|
* ```
|
|
208
211
|
*/
|
|
@@ -211,7 +214,7 @@ interface CanvasPolygonLayerPropsWithCustomStyle<T> extends CanvasPolygonLayerBa
|
|
|
211
214
|
* 폴리곤 스타일 커스터마이징 함수
|
|
212
215
|
*
|
|
213
216
|
* item 데이터와 상태 정보를 기반으로 자유롭게 스타일을 커스터마이징할 수 있습니다.
|
|
214
|
-
*
|
|
217
|
+
* 스타일을 반환하지 않거나 null/undefined를 반환하면 해당 폴리곤을 그리지 않습니다.
|
|
215
218
|
*/
|
|
216
219
|
customStyle: PolygonStyleCustomizer<T>;
|
|
217
220
|
/** 다른 방식 props는 사용 불가 */
|
|
@@ -247,6 +250,11 @@ declare const CanvasPolygonLayer: <T>(props: CanvasPolygonLayerProps<T>) => Reac
|
|
|
247
250
|
/**
|
|
248
251
|
* CanvasPolygonLayer - Konva 기반 고성능 폴리곤 렌더링 컴포넌트
|
|
249
252
|
*
|
|
253
|
+
* 세 가지 스타일 지정 방식을 지원합니다 (mutually exclusive):
|
|
254
|
+
* 1. 개별 props 방식: baseFillColor, baseStrokeColor, baseLineWidth 등 개별 props 사용
|
|
255
|
+
* 2. 객체 방식: renderStyle 객체로 상태별 스타일 정의
|
|
256
|
+
* 3. 함수 방식: customStyle 함수로 완전한 커스터마이징 (스타일을 반환하지 않으면 그리지 않음)
|
|
257
|
+
*
|
|
250
258
|
* @template T 폴리곤 데이터의 추가 속성 타입
|
|
251
259
|
*/
|
|
252
260
|
export default CanvasPolygonLayer;
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 이 파일은 폴리곤 렌더링을 위한 헬퍼 함수와 팩토리 함수를 제공합니다.
|
|
5
5
|
* GeoJSON MultiPolygon 형식을 지원하며, 도넛 폴리곤(구멍이 있는 폴리곤)도 처리할 수 있습니다.
|
|
6
|
+
*
|
|
7
|
+
* 세 가지 스타일 지정 방식을 지원하는 렌더링 함수를 제공합니다:
|
|
8
|
+
* 1. 개별 props 방식: renderPolygonBase, renderPolygonEvent
|
|
9
|
+
* 2. 객체 방식: renderPolygonBaseWithObject, renderPolygonEventWithObject
|
|
10
|
+
* 3. 함수 방식: renderPolygonBaseWithCustomStyle, renderPolygonEventWithCustomStyle
|
|
6
11
|
*/
|
|
7
12
|
import { CustomRenderBase, CustomRenderEvent } from "../shared/types";
|
|
8
13
|
import type { PolygonStyleObject, PolygonStyleCustomizer } from "./CanvasPolygonLayer";
|
|
@@ -190,11 +195,11 @@ export declare const renderPolygonEventWithObject: <T = any>(renderStyle: Polygo
|
|
|
190
195
|
* @example
|
|
191
196
|
* ```typescript
|
|
192
197
|
* const renderBase = renderPolygonBaseWithCustomStyle<MyDataType>(
|
|
193
|
-
* (item, context
|
|
198
|
+
* (item, context) => {
|
|
194
199
|
* if (item.someProperty > 100) {
|
|
195
200
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
196
201
|
* }
|
|
197
|
-
*
|
|
202
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
198
203
|
* }
|
|
199
204
|
* );
|
|
200
205
|
* ```
|
|
@@ -218,7 +223,7 @@ export declare const renderPolygonBaseWithCustomStyle: <T = any>(customStyle: Po
|
|
|
218
223
|
* @example
|
|
219
224
|
* ```typescript
|
|
220
225
|
* const renderEvent = renderPolygonEventWithCustomStyle<MyDataType>(
|
|
221
|
-
* (item, context
|
|
226
|
+
* (item, context) => {
|
|
222
227
|
* if (context.isActive) {
|
|
223
228
|
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
224
229
|
* }
|
|
@@ -228,7 +233,7 @@ export declare const renderPolygonBaseWithCustomStyle: <T = any>(customStyle: Po
|
|
|
228
233
|
* if (context.isSelected) {
|
|
229
234
|
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
230
235
|
* }
|
|
231
|
-
*
|
|
236
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
232
237
|
* }
|
|
233
238
|
* );
|
|
234
239
|
* ```
|
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
*
|
|
8
8
|
* 이 파일은 폴리곤 렌더링을 위한 헬퍼 함수와 팩토리 함수를 제공합니다.
|
|
9
9
|
* GeoJSON MultiPolygon 형식을 지원하며, 도넛 폴리곤(구멍이 있는 폴리곤)도 처리할 수 있습니다.
|
|
10
|
+
*
|
|
11
|
+
* 세 가지 스타일 지정 방식을 지원하는 렌더링 함수를 제공합니다:
|
|
12
|
+
* 1. 개별 props 방식: renderPolygonBase, renderPolygonEvent
|
|
13
|
+
* 2. 객체 방식: renderPolygonBaseWithObject, renderPolygonEventWithObject
|
|
14
|
+
* 3. 함수 방식: renderPolygonBaseWithCustomStyle, renderPolygonEventWithCustomStyle
|
|
10
15
|
*/
|
|
11
|
-
|
|
12
|
-
var DEFAULT_BASE_STYLE = {
|
|
13
|
-
fillColor: 'rgba(128, 128, 128, 0.5)',
|
|
14
|
-
strokeColor: 'rgba(0, 0, 0, 0.8)',
|
|
15
|
-
lineWidth: 2
|
|
16
|
-
};
|
|
16
|
+
|
|
17
17
|
/**
|
|
18
18
|
* 폴리곤 그리기 헬퍼 함수 (도넛 폴리곤 지원)
|
|
19
19
|
*
|
|
@@ -41,7 +41,6 @@ var DEFAULT_BASE_STYLE = {
|
|
|
41
41
|
* });
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
44
|
var drawPolygon = function (_a) {
|
|
46
45
|
var ctx = _a.ctx,
|
|
47
46
|
polygonOffsets = _a.polygonOffsets,
|
|
@@ -471,11 +470,11 @@ var renderPolygonEventWithObject = function (renderStyle) {
|
|
|
471
470
|
* @example
|
|
472
471
|
* ```typescript
|
|
473
472
|
* const renderBase = renderPolygonBaseWithCustomStyle<MyDataType>(
|
|
474
|
-
* (item, context
|
|
473
|
+
* (item, context) => {
|
|
475
474
|
* if (item.someProperty > 100) {
|
|
476
475
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
477
476
|
* }
|
|
478
|
-
*
|
|
477
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
479
478
|
* }
|
|
480
479
|
* );
|
|
481
480
|
* ```
|
|
@@ -496,14 +495,16 @@ var renderPolygonBaseWithCustomStyle = function (customStyle) {
|
|
|
496
495
|
if (!item.paths) continue; // 좌표 변환 (자동 캐싱)
|
|
497
496
|
|
|
498
497
|
var polygonOffsets = utils.getOrComputePolygonOffsets(item);
|
|
499
|
-
if (!polygonOffsets) continue; // Base Layer는 선택되지 않은 항목만 그리므로
|
|
498
|
+
if (!polygonOffsets) continue; // Base Layer는 선택되지 않은 항목만 그리므로
|
|
500
499
|
|
|
501
500
|
var context = {
|
|
502
501
|
isSelected: false,
|
|
503
502
|
isHovered: false,
|
|
504
503
|
isActive: false
|
|
505
504
|
};
|
|
506
|
-
var style = customStyle(item, context
|
|
505
|
+
var style = customStyle(item, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
506
|
+
|
|
507
|
+
if (!style) continue; // 폴리곤 그리기
|
|
507
508
|
|
|
508
509
|
drawPolygon({
|
|
509
510
|
ctx: ctx,
|
|
@@ -534,7 +535,7 @@ var renderPolygonBaseWithCustomStyle = function (customStyle) {
|
|
|
534
535
|
* @example
|
|
535
536
|
* ```typescript
|
|
536
537
|
* const renderEvent = renderPolygonEventWithCustomStyle<MyDataType>(
|
|
537
|
-
* (item, context
|
|
538
|
+
* (item, context) => {
|
|
538
539
|
* if (context.isActive) {
|
|
539
540
|
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
540
541
|
* }
|
|
@@ -544,7 +545,7 @@ var renderPolygonBaseWithCustomStyle = function (customStyle) {
|
|
|
544
545
|
* if (context.isSelected) {
|
|
545
546
|
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
546
547
|
* }
|
|
547
|
-
*
|
|
548
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
548
549
|
* }
|
|
549
550
|
* );
|
|
550
551
|
* ```
|
|
@@ -577,7 +578,9 @@ var renderPolygonEventWithCustomStyle = function (customStyle) {
|
|
|
577
578
|
isHovered: false,
|
|
578
579
|
isActive: false
|
|
579
580
|
};
|
|
580
|
-
var style = customStyle(item, context
|
|
581
|
+
var style = customStyle(item, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
582
|
+
|
|
583
|
+
if (!style) continue;
|
|
581
584
|
drawPolygon({
|
|
582
585
|
ctx: ctx,
|
|
583
586
|
polygonOffsets: polygonOffsets,
|
|
@@ -599,7 +602,9 @@ var renderPolygonEventWithCustomStyle = function (customStyle) {
|
|
|
599
602
|
isHovered: false,
|
|
600
603
|
isActive: true
|
|
601
604
|
};
|
|
602
|
-
var style = customStyle(selectedItem, context
|
|
605
|
+
var style = customStyle(selectedItem, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
606
|
+
|
|
607
|
+
if (!style) return;
|
|
603
608
|
drawPolygon({
|
|
604
609
|
ctx: ctx,
|
|
605
610
|
polygonOffsets: polygonOffsets,
|
|
@@ -623,7 +628,9 @@ var renderPolygonEventWithCustomStyle = function (customStyle) {
|
|
|
623
628
|
isHovered: !isSelected,
|
|
624
629
|
isActive: isSelected && hoveredItem.id === selectedItemId
|
|
625
630
|
};
|
|
626
|
-
var style = customStyle(hoveredItem, context
|
|
631
|
+
var style = customStyle(hoveredItem, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
632
|
+
|
|
633
|
+
if (!style) return;
|
|
627
634
|
drawPolygon({
|
|
628
635
|
ctx: ctx,
|
|
629
636
|
polygonOffsets: polygonOffsets,
|
package/dist/index.es.js
CHANGED
|
@@ -5756,13 +5756,13 @@ var CanvasMarkerLayer = function (props) {
|
|
|
5756
5756
|
*
|
|
5757
5757
|
* 이 파일은 폴리곤 렌더링을 위한 헬퍼 함수와 팩토리 함수를 제공합니다.
|
|
5758
5758
|
* GeoJSON MultiPolygon 형식을 지원하며, 도넛 폴리곤(구멍이 있는 폴리곤)도 처리할 수 있습니다.
|
|
5759
|
+
*
|
|
5760
|
+
* 세 가지 스타일 지정 방식을 지원하는 렌더링 함수를 제공합니다:
|
|
5761
|
+
* 1. 개별 props 방식: renderPolygonBase, renderPolygonEvent
|
|
5762
|
+
* 2. 객체 방식: renderPolygonBaseWithObject, renderPolygonEventWithObject
|
|
5763
|
+
* 3. 함수 방식: renderPolygonBaseWithCustomStyle, renderPolygonEventWithCustomStyle
|
|
5759
5764
|
*/
|
|
5760
|
-
|
|
5761
|
-
var DEFAULT_BASE_STYLE = {
|
|
5762
|
-
fillColor: 'rgba(128, 128, 128, 0.5)',
|
|
5763
|
-
strokeColor: 'rgba(0, 0, 0, 0.8)',
|
|
5764
|
-
lineWidth: 2
|
|
5765
|
-
};
|
|
5765
|
+
|
|
5766
5766
|
/**
|
|
5767
5767
|
* 폴리곤 그리기 헬퍼 함수 (도넛 폴리곤 지원)
|
|
5768
5768
|
*
|
|
@@ -5790,7 +5790,6 @@ var DEFAULT_BASE_STYLE = {
|
|
|
5790
5790
|
* });
|
|
5791
5791
|
* ```
|
|
5792
5792
|
*/
|
|
5793
|
-
|
|
5794
5793
|
var drawPolygon = function (_a) {
|
|
5795
5794
|
var ctx = _a.ctx,
|
|
5796
5795
|
polygonOffsets = _a.polygonOffsets,
|
|
@@ -6220,11 +6219,11 @@ var renderPolygonEventWithObject = function (renderStyle) {
|
|
|
6220
6219
|
* @example
|
|
6221
6220
|
* ```typescript
|
|
6222
6221
|
* const renderBase = renderPolygonBaseWithCustomStyle<MyDataType>(
|
|
6223
|
-
* (item, context
|
|
6222
|
+
* (item, context) => {
|
|
6224
6223
|
* if (item.someProperty > 100) {
|
|
6225
6224
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
6226
6225
|
* }
|
|
6227
|
-
*
|
|
6226
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
6228
6227
|
* }
|
|
6229
6228
|
* );
|
|
6230
6229
|
* ```
|
|
@@ -6245,14 +6244,16 @@ var renderPolygonBaseWithCustomStyle = function (customStyle) {
|
|
|
6245
6244
|
if (!item.paths) continue; // 좌표 변환 (자동 캐싱)
|
|
6246
6245
|
|
|
6247
6246
|
var polygonOffsets = utils.getOrComputePolygonOffsets(item);
|
|
6248
|
-
if (!polygonOffsets) continue; // Base Layer는 선택되지 않은 항목만 그리므로
|
|
6247
|
+
if (!polygonOffsets) continue; // Base Layer는 선택되지 않은 항목만 그리므로
|
|
6249
6248
|
|
|
6250
6249
|
var context = {
|
|
6251
6250
|
isSelected: false,
|
|
6252
6251
|
isHovered: false,
|
|
6253
6252
|
isActive: false
|
|
6254
6253
|
};
|
|
6255
|
-
var style = customStyle(item, context
|
|
6254
|
+
var style = customStyle(item, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6255
|
+
|
|
6256
|
+
if (!style) continue; // 폴리곤 그리기
|
|
6256
6257
|
|
|
6257
6258
|
drawPolygon({
|
|
6258
6259
|
ctx: ctx,
|
|
@@ -6283,7 +6284,7 @@ var renderPolygonBaseWithCustomStyle = function (customStyle) {
|
|
|
6283
6284
|
* @example
|
|
6284
6285
|
* ```typescript
|
|
6285
6286
|
* const renderEvent = renderPolygonEventWithCustomStyle<MyDataType>(
|
|
6286
|
-
* (item, context
|
|
6287
|
+
* (item, context) => {
|
|
6287
6288
|
* if (context.isActive) {
|
|
6288
6289
|
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
6289
6290
|
* }
|
|
@@ -6293,7 +6294,7 @@ var renderPolygonBaseWithCustomStyle = function (customStyle) {
|
|
|
6293
6294
|
* if (context.isSelected) {
|
|
6294
6295
|
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
6295
6296
|
* }
|
|
6296
|
-
*
|
|
6297
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
6297
6298
|
* }
|
|
6298
6299
|
* );
|
|
6299
6300
|
* ```
|
|
@@ -6326,7 +6327,9 @@ var renderPolygonEventWithCustomStyle = function (customStyle) {
|
|
|
6326
6327
|
isHovered: false,
|
|
6327
6328
|
isActive: false
|
|
6328
6329
|
};
|
|
6329
|
-
var style = customStyle(item, context
|
|
6330
|
+
var style = customStyle(item, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6331
|
+
|
|
6332
|
+
if (!style) continue;
|
|
6330
6333
|
drawPolygon({
|
|
6331
6334
|
ctx: ctx,
|
|
6332
6335
|
polygonOffsets: polygonOffsets,
|
|
@@ -6348,7 +6351,9 @@ var renderPolygonEventWithCustomStyle = function (customStyle) {
|
|
|
6348
6351
|
isHovered: false,
|
|
6349
6352
|
isActive: true
|
|
6350
6353
|
};
|
|
6351
|
-
var style = customStyle(selectedItem, context
|
|
6354
|
+
var style = customStyle(selectedItem, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6355
|
+
|
|
6356
|
+
if (!style) return;
|
|
6352
6357
|
drawPolygon({
|
|
6353
6358
|
ctx: ctx,
|
|
6354
6359
|
polygonOffsets: polygonOffsets,
|
|
@@ -6372,7 +6377,9 @@ var renderPolygonEventWithCustomStyle = function (customStyle) {
|
|
|
6372
6377
|
isHovered: !isSelected,
|
|
6373
6378
|
isActive: isSelected && hoveredItem.id === selectedItemId
|
|
6374
6379
|
};
|
|
6375
|
-
var style = customStyle(hoveredItem, context
|
|
6380
|
+
var style = customStyle(hoveredItem, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6381
|
+
|
|
6382
|
+
if (!style) return;
|
|
6376
6383
|
drawPolygon({
|
|
6377
6384
|
ctx: ctx,
|
|
6378
6385
|
polygonOffsets: polygonOffsets,
|
package/dist/index.umd.js
CHANGED
|
@@ -5760,13 +5760,13 @@
|
|
|
5760
5760
|
*
|
|
5761
5761
|
* 이 파일은 폴리곤 렌더링을 위한 헬퍼 함수와 팩토리 함수를 제공합니다.
|
|
5762
5762
|
* GeoJSON MultiPolygon 형식을 지원하며, 도넛 폴리곤(구멍이 있는 폴리곤)도 처리할 수 있습니다.
|
|
5763
|
+
*
|
|
5764
|
+
* 세 가지 스타일 지정 방식을 지원하는 렌더링 함수를 제공합니다:
|
|
5765
|
+
* 1. 개별 props 방식: renderPolygonBase, renderPolygonEvent
|
|
5766
|
+
* 2. 객체 방식: renderPolygonBaseWithObject, renderPolygonEventWithObject
|
|
5767
|
+
* 3. 함수 방식: renderPolygonBaseWithCustomStyle, renderPolygonEventWithCustomStyle
|
|
5763
5768
|
*/
|
|
5764
|
-
|
|
5765
|
-
var DEFAULT_BASE_STYLE = {
|
|
5766
|
-
fillColor: 'rgba(128, 128, 128, 0.5)',
|
|
5767
|
-
strokeColor: 'rgba(0, 0, 0, 0.8)',
|
|
5768
|
-
lineWidth: 2
|
|
5769
|
-
};
|
|
5769
|
+
|
|
5770
5770
|
/**
|
|
5771
5771
|
* 폴리곤 그리기 헬퍼 함수 (도넛 폴리곤 지원)
|
|
5772
5772
|
*
|
|
@@ -5794,7 +5794,6 @@
|
|
|
5794
5794
|
* });
|
|
5795
5795
|
* ```
|
|
5796
5796
|
*/
|
|
5797
|
-
|
|
5798
5797
|
var drawPolygon = function (_a) {
|
|
5799
5798
|
var ctx = _a.ctx,
|
|
5800
5799
|
polygonOffsets = _a.polygonOffsets,
|
|
@@ -6224,11 +6223,11 @@
|
|
|
6224
6223
|
* @example
|
|
6225
6224
|
* ```typescript
|
|
6226
6225
|
* const renderBase = renderPolygonBaseWithCustomStyle<MyDataType>(
|
|
6227
|
-
* (item, context
|
|
6226
|
+
* (item, context) => {
|
|
6228
6227
|
* if (item.someProperty > 100) {
|
|
6229
6228
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
6230
6229
|
* }
|
|
6231
|
-
*
|
|
6230
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
6232
6231
|
* }
|
|
6233
6232
|
* );
|
|
6234
6233
|
* ```
|
|
@@ -6249,14 +6248,16 @@
|
|
|
6249
6248
|
if (!item.paths) continue; // 좌표 변환 (자동 캐싱)
|
|
6250
6249
|
|
|
6251
6250
|
var polygonOffsets = utils.getOrComputePolygonOffsets(item);
|
|
6252
|
-
if (!polygonOffsets) continue; // Base Layer는 선택되지 않은 항목만 그리므로
|
|
6251
|
+
if (!polygonOffsets) continue; // Base Layer는 선택되지 않은 항목만 그리므로
|
|
6253
6252
|
|
|
6254
6253
|
var context = {
|
|
6255
6254
|
isSelected: false,
|
|
6256
6255
|
isHovered: false,
|
|
6257
6256
|
isActive: false
|
|
6258
6257
|
};
|
|
6259
|
-
var style = customStyle(item, context
|
|
6258
|
+
var style = customStyle(item, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6259
|
+
|
|
6260
|
+
if (!style) continue; // 폴리곤 그리기
|
|
6260
6261
|
|
|
6261
6262
|
drawPolygon({
|
|
6262
6263
|
ctx: ctx,
|
|
@@ -6287,7 +6288,7 @@
|
|
|
6287
6288
|
* @example
|
|
6288
6289
|
* ```typescript
|
|
6289
6290
|
* const renderEvent = renderPolygonEventWithCustomStyle<MyDataType>(
|
|
6290
|
-
* (item, context
|
|
6291
|
+
* (item, context) => {
|
|
6291
6292
|
* if (context.isActive) {
|
|
6292
6293
|
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
6293
6294
|
* }
|
|
@@ -6297,7 +6298,7 @@
|
|
|
6297
6298
|
* if (context.isSelected) {
|
|
6298
6299
|
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
6299
6300
|
* }
|
|
6300
|
-
*
|
|
6301
|
+
* // 아무것도 반환하지 않으면 그리지 않음
|
|
6301
6302
|
* }
|
|
6302
6303
|
* );
|
|
6303
6304
|
* ```
|
|
@@ -6330,7 +6331,9 @@
|
|
|
6330
6331
|
isHovered: false,
|
|
6331
6332
|
isActive: false
|
|
6332
6333
|
};
|
|
6333
|
-
var style = customStyle(item, context
|
|
6334
|
+
var style = customStyle(item, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6335
|
+
|
|
6336
|
+
if (!style) continue;
|
|
6334
6337
|
drawPolygon({
|
|
6335
6338
|
ctx: ctx,
|
|
6336
6339
|
polygonOffsets: polygonOffsets,
|
|
@@ -6352,7 +6355,9 @@
|
|
|
6352
6355
|
isHovered: false,
|
|
6353
6356
|
isActive: true
|
|
6354
6357
|
};
|
|
6355
|
-
var style = customStyle(selectedItem, context
|
|
6358
|
+
var style = customStyle(selectedItem, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6359
|
+
|
|
6360
|
+
if (!style) return;
|
|
6356
6361
|
drawPolygon({
|
|
6357
6362
|
ctx: ctx,
|
|
6358
6363
|
polygonOffsets: polygonOffsets,
|
|
@@ -6376,7 +6381,9 @@
|
|
|
6376
6381
|
isHovered: !isSelected,
|
|
6377
6382
|
isActive: isSelected && hoveredItem.id === selectedItemId
|
|
6378
6383
|
};
|
|
6379
|
-
var style = customStyle(hoveredItem, context
|
|
6384
|
+
var style = customStyle(hoveredItem, context); // null 또는 undefined를 반환하면 그리지 않음
|
|
6385
|
+
|
|
6386
|
+
if (!style) return;
|
|
6380
6387
|
drawPolygon({
|
|
6381
6388
|
ctx: ctx,
|
|
6382
6389
|
polygonOffsets: polygonOffsets,
|