@mint-ui/map 1.2.0-test.50 → 1.2.0-test.51
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 +107 -38
- package/dist/components/mint-map/core/advanced/CanvasPolygonLayer/CanvasPolygonLayer.js +11 -8
- package/dist/components/mint-map/core/advanced/CanvasPolygonLayer/renderer.d.ts +76 -22
- package/dist/components/mint-map/core/advanced/CanvasPolygonLayer/renderer.js +202 -39
- package/dist/index.es.js +209 -45
- package/dist/index.umd.js +209 -45
- package/package.json +1 -1
|
@@ -26,41 +26,59 @@ export interface PolygonStyleContext {
|
|
|
26
26
|
isActive: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* 폴리곤 스타일
|
|
29
|
+
* 폴리곤 스타일 객체
|
|
30
30
|
*
|
|
31
|
-
*
|
|
31
|
+
* 상태별 스타일을 정의합니다. 개별 props 방식과 동일한 알고리즘으로 적용됩니다.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* renderStyle={{
|
|
36
|
+
* base: { fillColor: 'gray', strokeColor: 'black', lineWidth: 2 },
|
|
37
|
+
* selected: { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 },
|
|
38
|
+
* active: { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 },
|
|
39
|
+
* hovered: { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 }
|
|
40
|
+
* }}
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export interface PolygonStyleObject {
|
|
44
|
+
/** 기본 폴리곤 스타일 (필수) */
|
|
45
|
+
base: PolygonStyle;
|
|
46
|
+
/** 선택된 폴리곤 스타일 */
|
|
47
|
+
selected?: PolygonStyle;
|
|
48
|
+
/** 활성 폴리곤 스타일 (마지막 선택된 항목) */
|
|
49
|
+
active?: PolygonStyle;
|
|
50
|
+
/** 호버된 폴리곤 스타일 */
|
|
51
|
+
hovered?: PolygonStyle;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 폴리곤 스타일 커스터마이징 함수 타입
|
|
55
|
+
*
|
|
56
|
+
* item 데이터와 상태 정보를 기반으로 자유롭게 스타일을 커스터마이징할 수 있습니다.
|
|
32
57
|
*
|
|
33
58
|
* @param item 폴리곤 데이터
|
|
34
59
|
* @param context 선택/호버/활성 상태 정보
|
|
35
|
-
* @
|
|
60
|
+
* @param defaultStyle 기본 스타일 (renderStyle 객체 또는 개별 props로부터 계산된 스타일)
|
|
61
|
+
* @returns 커스터마이징된 폴리곤 스타일
|
|
36
62
|
*
|
|
37
63
|
* @example
|
|
38
64
|
* ```typescript
|
|
39
|
-
*
|
|
65
|
+
* customStyle={(item, context, defaultStyle) => {
|
|
40
66
|
* // item의 속성에 따라 동적으로 스타일 결정
|
|
41
67
|
* if (item.someProperty > 100) {
|
|
42
68
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
43
69
|
* }
|
|
44
70
|
*
|
|
45
|
-
* //
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* return { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 };
|
|
51
|
-
* }
|
|
52
|
-
* if (context.isSelected) {
|
|
53
|
-
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
54
|
-
* }
|
|
55
|
-
*
|
|
56
|
-
* // 기본 스타일
|
|
57
|
-
* return { fillColor: 'gray', strokeColor: 'black', lineWidth: 2 };
|
|
71
|
+
* // 기본 스타일을 기반으로 일부만 수정
|
|
72
|
+
* return {
|
|
73
|
+
* ...defaultStyle,
|
|
74
|
+
* fillColor: context.isActive ? 'yellow' : defaultStyle.fillColor
|
|
75
|
+
* };
|
|
58
76
|
* }}
|
|
59
77
|
* ```
|
|
60
78
|
*/
|
|
61
|
-
export declare type
|
|
79
|
+
export declare type PolygonStyleCustomizer<T> = (item: CanvasData<T>, context: PolygonStyleContext, defaultStyle: PolygonStyle) => PolygonStyle;
|
|
62
80
|
/**
|
|
63
|
-
* 공통 Props (
|
|
81
|
+
* 공통 Props (모든 방식 공통)
|
|
64
82
|
*/
|
|
65
83
|
interface CanvasPolygonLayerBaseProps<T> extends Pick<MarkerOptions, 'zIndex' | 'anchor' | 'visible'> {
|
|
66
84
|
/** 렌더링할 폴리곤 데이터 배열 */
|
|
@@ -112,40 +130,91 @@ interface CanvasPolygonLayerPropsWithIndividualStyles<T> extends CanvasPolygonLa
|
|
|
112
130
|
hoveredStrokeColor?: string;
|
|
113
131
|
/** Hover 시 폴리곤 테두리 두께 */
|
|
114
132
|
hoveredLineWidth?: number;
|
|
115
|
-
/**
|
|
133
|
+
/** 다른 방식 props는 사용 불가 */
|
|
116
134
|
renderStyle?: never;
|
|
135
|
+
customStyle?: never;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 객체 Props 방식 (새로운 방식)
|
|
139
|
+
*
|
|
140
|
+
* renderStyle 객체가 있으면 자동으로 객체 방식으로 인식됩니다.
|
|
141
|
+
* 상태별 스타일을 정의하면 개별 props 방식과 동일한 알고리즘으로 적용됩니다.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* renderStyle={{
|
|
146
|
+
* base: { fillColor: 'gray', strokeColor: 'black', lineWidth: 2 },
|
|
147
|
+
* selected: { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 },
|
|
148
|
+
* active: { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 },
|
|
149
|
+
* hovered: { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 }
|
|
150
|
+
* }}
|
|
151
|
+
* customStyle={(item, context, defaultStyle) => {
|
|
152
|
+
* // 기본 스타일을 기반으로 추가 커스터마이징
|
|
153
|
+
* return { ...defaultStyle, fillColor: item.someProperty > 100 ? 'red' : defaultStyle.fillColor };
|
|
154
|
+
* }}
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
interface CanvasPolygonLayerPropsWithObjectStyle<T> extends CanvasPolygonLayerBaseProps<T> {
|
|
158
|
+
/**
|
|
159
|
+
* 폴리곤 스타일 객체
|
|
160
|
+
*
|
|
161
|
+
* 상태별 스타일을 정의합니다. 개별 props 방식과 동일한 알고리즘으로 적용됩니다.
|
|
162
|
+
*/
|
|
163
|
+
renderStyle: PolygonStyleObject;
|
|
164
|
+
/** 다른 방식 props는 사용 불가 */
|
|
165
|
+
baseFillColor?: never;
|
|
166
|
+
baseStrokeColor?: never;
|
|
167
|
+
baseLineWidth?: never;
|
|
168
|
+
selectedFillColor?: never;
|
|
169
|
+
selectedStrokeColor?: never;
|
|
170
|
+
selectedLineWidth?: never;
|
|
171
|
+
activeFillColor?: never;
|
|
172
|
+
activeStrokeColor?: never;
|
|
173
|
+
activeLineWidth?: never;
|
|
174
|
+
hoveredFillColor?: never;
|
|
175
|
+
hoveredStrokeColor?: never;
|
|
176
|
+
hoveredLineWidth?: never;
|
|
177
|
+
customStyle?: never;
|
|
117
178
|
}
|
|
118
179
|
/**
|
|
119
|
-
* 함수 Props 방식 (
|
|
180
|
+
* 함수 Props 방식 (커스터마이징 방식)
|
|
120
181
|
*
|
|
121
|
-
*
|
|
182
|
+
* customStyle 함수가 있으면 자동으로 함수 방식으로 인식됩니다.
|
|
122
183
|
* item 데이터와 상태 정보를 기반으로 자유롭게 스타일을 커스터마이징할 수 있습니다.
|
|
123
184
|
*
|
|
124
185
|
* @example
|
|
125
186
|
* ```typescript
|
|
126
|
-
*
|
|
187
|
+
* customStyle={(item, context, defaultStyle) => {
|
|
127
188
|
* // item의 속성에 따라 동적으로 스타일 결정
|
|
128
189
|
* if (item.someProperty > 100) {
|
|
129
190
|
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
130
191
|
* }
|
|
192
|
+
*
|
|
131
193
|
* // 상태 정보를 기반으로 스타일 결정
|
|
132
194
|
* if (context.isActive) {
|
|
133
195
|
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
134
196
|
* }
|
|
135
|
-
*
|
|
197
|
+
* if (context.isHovered) {
|
|
198
|
+
* return { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 };
|
|
199
|
+
* }
|
|
200
|
+
* if (context.isSelected) {
|
|
201
|
+
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
202
|
+
* }
|
|
203
|
+
*
|
|
204
|
+
* // 기본 스타일
|
|
205
|
+
* return { fillColor: 'gray', strokeColor: 'black', lineWidth: 2 };
|
|
136
206
|
* }}
|
|
137
207
|
* ```
|
|
138
208
|
*/
|
|
139
|
-
interface
|
|
209
|
+
interface CanvasPolygonLayerPropsWithCustomStyle<T> extends CanvasPolygonLayerBaseProps<T> {
|
|
140
210
|
/**
|
|
141
|
-
* 폴리곤 스타일 함수
|
|
211
|
+
* 폴리곤 스타일 커스터마이징 함수
|
|
142
212
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @returns 폴리곤 스타일
|
|
213
|
+
* item 데이터와 상태 정보를 기반으로 자유롭게 스타일을 커스터마이징할 수 있습니다.
|
|
214
|
+
* defaultStyle은 내부에서 계산된 기본 스타일입니다.
|
|
146
215
|
*/
|
|
147
|
-
|
|
148
|
-
/**
|
|
216
|
+
customStyle: PolygonStyleCustomizer<T>;
|
|
217
|
+
/** 다른 방식 props는 사용 불가 */
|
|
149
218
|
baseFillColor?: never;
|
|
150
219
|
baseStrokeColor?: never;
|
|
151
220
|
baseLineWidth?: never;
|
|
@@ -158,22 +227,22 @@ interface CanvasPolygonLayerPropsWithFunctionStyle<T> extends CanvasPolygonLayer
|
|
|
158
227
|
hoveredFillColor?: never;
|
|
159
228
|
hoveredStrokeColor?: never;
|
|
160
229
|
hoveredLineWidth?: never;
|
|
230
|
+
renderStyle?: never;
|
|
161
231
|
}
|
|
162
232
|
/**
|
|
163
233
|
* CanvasPolygonLayer Props (Discriminated Union)
|
|
164
234
|
*
|
|
165
|
-
*
|
|
235
|
+
* 세 가지 스타일 지정 방식을 지원:
|
|
166
236
|
* 1. 개별 props 방식: baseFillColor, baseStrokeColor, baseLineWidth가 있으면 자동으로 개별 props 방식
|
|
167
|
-
* 2.
|
|
168
|
-
*
|
|
169
|
-
* 두 방식은 동시에 사용할 수 없습니다 (mutually exclusive).
|
|
170
|
-
* styleMode prop은 필요 없으며, renderStyle 또는 baseFillColor의 존재 여부로 자동 판단됩니다.
|
|
237
|
+
* 2. 객체 방식: renderStyle 객체가 있으면 자동으로 객체 방식
|
|
238
|
+
* 3. 함수 방식: customStyle 함수가 있으면 자동으로 함수 방식
|
|
171
239
|
*
|
|
172
|
-
*
|
|
240
|
+
* 세 방식은 동시에 사용할 수 없습니다 (mutually exclusive).
|
|
241
|
+
* styleMode prop은 필요 없으며, 각 prop의 존재 여부로 자동 판단됩니다.
|
|
173
242
|
*
|
|
174
243
|
* @template T 폴리곤 데이터의 추가 속성 타입
|
|
175
244
|
*/
|
|
176
|
-
export declare type CanvasPolygonLayerProps<T> = CanvasPolygonLayerPropsWithIndividualStyles<T> |
|
|
245
|
+
export declare type CanvasPolygonLayerProps<T> = CanvasPolygonLayerPropsWithIndividualStyles<T> | CanvasPolygonLayerPropsWithObjectStyle<T> | CanvasPolygonLayerPropsWithCustomStyle<T>;
|
|
177
246
|
declare const CanvasPolygonLayer: <T>(props: CanvasPolygonLayerProps<T>) => React.ReactPortal;
|
|
178
247
|
/**
|
|
179
248
|
* CanvasPolygonLayer - Konva 기반 고성능 폴리곤 렌더링 컴포넌트
|
|
@@ -39,13 +39,16 @@ var CanvasPolygonLayer = function (props) {
|
|
|
39
39
|
externalSelectedItem = props.selectedItem,
|
|
40
40
|
_e = props.disableInteraction,
|
|
41
41
|
disableInteraction = _e === void 0 ? false : _e,
|
|
42
|
-
options = tslib.__rest(props, ["data", "onClick", "enableMultiSelect", "enableViewportCulling", "cullingMargin", "maxCacheSize", "selectedItems", "selectedItem", "disableInteraction"]); //
|
|
42
|
+
options = tslib.__rest(props, ["data", "onClick", "enableMultiSelect", "enableViewportCulling", "cullingMargin", "maxCacheSize", "selectedItems", "selectedItem", "disableInteraction"]); // 세 가지 방식 중 하나만 선택: customStyle > renderStyle > 개별 props
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var isCustomStyleMode = 'customStyle' in props && props.customStyle !== undefined;
|
|
46
|
+
var isObjectMode = !isCustomStyleMode && 'renderStyle' in props && props.renderStyle !== undefined;
|
|
47
|
+
var isIndividualMode = !isCustomStyleMode && !isObjectMode; // 각 방식별 props 추출
|
|
46
48
|
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
+
var customStyleProps = isCustomStyleMode ? props : undefined;
|
|
50
|
+
var objectProps = isObjectMode ? props : undefined;
|
|
51
|
+
var individualProps = isIndividualMode ? props : undefined; // --------------------------------------------------------------------------
|
|
49
52
|
// Hooks & Context
|
|
50
53
|
// --------------------------------------------------------------------------
|
|
51
54
|
|
|
@@ -152,11 +155,11 @@ var CanvasPolygonLayer = function (props) {
|
|
|
152
155
|
}
|
|
153
156
|
}; // 렌더링 함수 생성 (스타일 지정 방식에 따라 분기)
|
|
154
157
|
|
|
155
|
-
var renderBase =
|
|
156
|
-
throw new Error('Invalid props:
|
|
158
|
+
var renderBase = isCustomStyleMode && customStyleProps ? renderer.renderPolygonBaseWithCustomStyle(customStyleProps.customStyle) : isObjectMode && objectProps ? renderer.renderPolygonBaseWithObject(objectProps.renderStyle) : isIndividualMode && individualProps ? renderer.renderPolygonBase(individualProps.baseFillColor, individualProps.baseStrokeColor, individualProps.baseLineWidth) : function () {
|
|
159
|
+
throw new Error('Invalid props: one of customStyle, renderStyle, or individual style props must be provided');
|
|
157
160
|
}();
|
|
158
|
-
var renderEvent =
|
|
159
|
-
throw new Error('Invalid props:
|
|
161
|
+
var renderEvent = isCustomStyleMode && customStyleProps ? renderer.renderPolygonEventWithCustomStyle(customStyleProps.customStyle) : isObjectMode && objectProps ? renderer.renderPolygonEventWithObject(objectProps.renderStyle) : isIndividualMode && individualProps ? renderer.renderPolygonEvent(individualProps.baseFillColor, individualProps.baseStrokeColor, individualProps.baseLineWidth, individualProps.selectedFillColor, individualProps.selectedStrokeColor, individualProps.selectedLineWidth, individualProps.activeFillColor, individualProps.activeStrokeColor, individualProps.activeLineWidth, individualProps.hoveredFillColor, individualProps.hoveredStrokeColor, individualProps.hoveredLineWidth) : function () {
|
|
162
|
+
throw new Error('Invalid props: one of customStyle, renderStyle, or individual style props must be provided');
|
|
160
163
|
}(); // Base Layer 렌더링 (뷰포트 컬링 적용)
|
|
161
164
|
|
|
162
165
|
var doRenderBase = function () {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* GeoJSON MultiPolygon 형식을 지원하며, 도넛 폴리곤(구멍이 있는 폴리곤)도 처리할 수 있습니다.
|
|
6
6
|
*/
|
|
7
7
|
import { CustomRenderBase, CustomRenderEvent } from "../shared/types";
|
|
8
|
-
import type {
|
|
8
|
+
import type { PolygonStyleObject, PolygonStyleCustomizer } from "./CanvasPolygonLayer";
|
|
9
9
|
/**
|
|
10
10
|
* 폴리곤 그리기 파라미터 인터페이스
|
|
11
11
|
*/
|
|
@@ -119,13 +119,13 @@ export declare const renderPolygonBase: <T = any>(baseFillColor: string, baseStr
|
|
|
119
119
|
*/
|
|
120
120
|
export declare const renderPolygonEvent: <T = any>(baseFillColor: string, baseStrokeColor: string, baseLineWidth: number, selectedFillColor?: string, selectedStrokeColor?: string, selectedLineWidth?: number, activeFillColor?: string, activeStrokeColor?: string, activeLineWidth?: number, hoveredFillColor?: string, hoveredStrokeColor?: string, hoveredLineWidth?: number) => CustomRenderEvent<T>;
|
|
121
121
|
/**
|
|
122
|
-
* 폴리곤 Base 렌더링 함수 팩토리 (
|
|
122
|
+
* 폴리곤 Base 렌더링 함수 팩토리 (객체 방식)
|
|
123
123
|
*
|
|
124
124
|
* Base Layer에서 사용할 렌더링 함수를 생성합니다.
|
|
125
|
-
* renderStyle
|
|
125
|
+
* renderStyle 객체를 사용하여 기본 스타일을 적용합니다.
|
|
126
126
|
*
|
|
127
127
|
* @template T 폴리곤 데이터의 추가 속성 타입
|
|
128
|
-
* @param renderStyle 폴리곤 스타일
|
|
128
|
+
* @param renderStyle 폴리곤 스타일 객체
|
|
129
129
|
* @returns Base Layer 렌더링 함수
|
|
130
130
|
*
|
|
131
131
|
* @remarks
|
|
@@ -135,49 +135,103 @@ export declare const renderPolygonEvent: <T = any>(baseFillColor: string, baseSt
|
|
|
135
135
|
*
|
|
136
136
|
* @example
|
|
137
137
|
* ```typescript
|
|
138
|
-
* const renderBase =
|
|
139
|
-
* (
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
* const renderBase = renderPolygonBaseWithObject<MyDataType>({
|
|
139
|
+
* base: { fillColor: 'rgba(255, 100, 100, 0.5)', strokeColor: 'rgba(200, 50, 50, 0.8)', lineWidth: 2 }
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export declare const renderPolygonBaseWithObject: <T = any>(renderStyle: PolygonStyleObject) => CustomRenderBase<T>;
|
|
144
|
+
/**
|
|
145
|
+
* 폴리곤 Event 렌더링 함수 팩토리 (객체 방식)
|
|
146
|
+
*
|
|
147
|
+
* Event Layer에서 사용할 렌더링 함수를 생성합니다.
|
|
148
|
+
* renderStyle 객체를 사용하여 개별 props 방식과 동일한 알고리즘으로 스타일을 적용합니다.
|
|
149
|
+
*
|
|
150
|
+
* @template T 폴리곤 데이터의 추가 속성 타입
|
|
151
|
+
* @param renderStyle 폴리곤 스타일 객체
|
|
152
|
+
* @returns Event Layer 렌더링 함수
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* - **렌더링 순서**: 선택된 항목 → 마지막 선택된 항목 → hover된 항목 (최상단)
|
|
156
|
+
* - **성능**: O(m), m은 선택된 항목 수 + hover된 항목 수
|
|
157
|
+
* - 좌표 변환은 자동으로 캐싱되어 성능 최적화됨
|
|
158
|
+
* - **알고리즘**: 개별 props 방식과 동일
|
|
159
|
+
* - 기본값 설정: selected/active/hovered가 없으면 base 또는 상위 값 사용
|
|
160
|
+
* - 선택된 항목: selected 스타일
|
|
161
|
+
* - 마지막 선택된 항목 (호버 안 됨): active 스타일
|
|
162
|
+
* - 호버된 항목: 선택되어 있으면 active, 아니면 hovered 스타일
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const renderEvent = renderPolygonEventWithObject<MyDataType>({
|
|
167
|
+
* base: { fillColor: 'rgba(255, 100, 100, 0.5)', strokeColor: 'rgba(200, 50, 50, 0.8)', lineWidth: 2 },
|
|
168
|
+
* selected: { fillColor: 'rgba(255, 193, 7, 0.7)', strokeColor: 'rgba(255, 152, 0, 1)', lineWidth: 4 },
|
|
169
|
+
* active: { fillColor: 'rgba(255, 152, 0, 0.8)', strokeColor: 'rgba(255, 87, 34, 1)', lineWidth: 5 },
|
|
170
|
+
* hovered: { fillColor: 'rgba(100, 150, 255, 0.8)', strokeColor: 'rgba(0, 100, 200, 1)', lineWidth: 3 }
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export declare const renderPolygonEventWithObject: <T = any>(renderStyle: PolygonStyleObject) => CustomRenderEvent<T>;
|
|
175
|
+
/**
|
|
176
|
+
* 폴리곤 Base 렌더링 함수 팩토리 (커스터마이징 방식)
|
|
177
|
+
*
|
|
178
|
+
* Base Layer에서 사용할 렌더링 함수를 생성합니다.
|
|
179
|
+
* customStyle 함수를 사용하여 각 폴리곤의 스타일을 자유롭게 커스터마이징합니다.
|
|
180
|
+
*
|
|
181
|
+
* @template T 폴리곤 데이터의 추가 속성 타입
|
|
182
|
+
* @param customStyle 폴리곤 스타일 커스터마이징 함수
|
|
183
|
+
* @returns Base Layer 렌더링 함수
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* - 선택된 항목은 Event Layer에서 그려지므로 Base Layer에서는 스킵
|
|
187
|
+
* - 성능: O(n), n은 렌더링할 폴리곤 개수
|
|
188
|
+
* - 좌표 변환은 자동으로 캐싱되어 성능 최적화됨
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const renderBase = renderPolygonBaseWithCustomStyle<MyDataType>(
|
|
193
|
+
* (item, context, defaultStyle) => {
|
|
194
|
+
* if (item.someProperty > 100) {
|
|
195
|
+
* return { fillColor: 'red', strokeColor: 'darkred', lineWidth: 3 };
|
|
196
|
+
* }
|
|
197
|
+
* return defaultStyle;
|
|
198
|
+
* }
|
|
144
199
|
* );
|
|
145
200
|
* ```
|
|
146
201
|
*/
|
|
147
|
-
export declare const
|
|
202
|
+
export declare const renderPolygonBaseWithCustomStyle: <T = any>(customStyle: PolygonStyleCustomizer<T>) => CustomRenderBase<T>;
|
|
148
203
|
/**
|
|
149
|
-
* 폴리곤 Event 렌더링 함수 팩토리 (
|
|
204
|
+
* 폴리곤 Event 렌더링 함수 팩토리 (커스터마이징 방식)
|
|
150
205
|
*
|
|
151
206
|
* Event Layer에서 사용할 렌더링 함수를 생성합니다.
|
|
152
|
-
*
|
|
207
|
+
* customStyle 함수를 사용하여 각 폴리곤의 스타일을 자유롭게 커스터마이징합니다.
|
|
153
208
|
*
|
|
154
209
|
* @template T 폴리곤 데이터의 추가 속성 타입
|
|
155
|
-
* @param
|
|
210
|
+
* @param customStyle 폴리곤 스타일 커스터마이징 함수
|
|
156
211
|
* @returns Event Layer 렌더링 함수
|
|
157
212
|
*
|
|
158
213
|
* @remarks
|
|
159
214
|
* - **렌더링 순서**: 선택된 항목 → 마지막 선택된 항목 → hover된 항목 (최상단)
|
|
160
215
|
* - **성능**: O(m), m은 선택된 항목 수 + hover된 항목 수
|
|
161
216
|
* - 좌표 변환은 자동으로 캐싱되어 성능 최적화됨
|
|
162
|
-
* - hover된 항목이 선택되어 있으면 active 스타일 적용
|
|
163
217
|
*
|
|
164
218
|
* @example
|
|
165
219
|
* ```typescript
|
|
166
|
-
* const renderEvent =
|
|
167
|
-
* (item, context) => {
|
|
220
|
+
* const renderEvent = renderPolygonEventWithCustomStyle<MyDataType>(
|
|
221
|
+
* (item, context, defaultStyle) => {
|
|
168
222
|
* if (context.isActive) {
|
|
169
|
-
* return { fillColor: '
|
|
223
|
+
* return { fillColor: 'yellow', strokeColor: 'orange', lineWidth: 5 };
|
|
170
224
|
* }
|
|
171
225
|
* if (context.isHovered) {
|
|
172
|
-
* return { fillColor: '
|
|
226
|
+
* return { fillColor: 'blue', strokeColor: 'darkblue', lineWidth: 3 };
|
|
173
227
|
* }
|
|
174
228
|
* if (context.isSelected) {
|
|
175
|
-
* return { fillColor: '
|
|
229
|
+
* return { fillColor: 'green', strokeColor: 'darkgreen', lineWidth: 4 };
|
|
176
230
|
* }
|
|
177
|
-
* return
|
|
231
|
+
* return defaultStyle;
|
|
178
232
|
* }
|
|
179
233
|
* );
|
|
180
234
|
* ```
|
|
181
235
|
*/
|
|
182
|
-
export declare const
|
|
236
|
+
export declare const renderPolygonEventWithCustomStyle: <T = any>(customStyle: PolygonStyleCustomizer<T>) => CustomRenderEvent<T>;
|
|
183
237
|
export {};
|