@mint-ui/map 1.2.0-test.14 → 1.2.0-test.16
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/woongCanvas/WoongCanvasLayer.d.ts +6 -11
- package/dist/components/mint-map/core/advanced/woongCanvas/WoongCanvasLayer.js +18 -37
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/renderer.d.ts +2 -2
- package/dist/components/mint-map/core/advanced/woongCanvas/shared/types.d.ts +16 -72
- package/dist/index.es.js +18 -37
- package/dist/index.umd.js +18 -37
- package/package.json +1 -1
|
@@ -35,17 +35,15 @@ interface WoongCanvasLayerBaseProps<T> extends Pick<MarkerOptions, 'zIndex' | 'a
|
|
|
35
35
|
/**
|
|
36
36
|
* MARKER 타입 Props - 커스텀 렌더링 필수
|
|
37
37
|
*/
|
|
38
|
-
interface WoongCanvasLayerPropsForMarker<T
|
|
38
|
+
interface WoongCanvasLayerPropsForMarker<T> extends WoongCanvasLayerBaseProps<T> {
|
|
39
39
|
/** 데이터 타입 */
|
|
40
40
|
dataType: CanvasDataType.MARKER;
|
|
41
41
|
/** Base Layer 렌더링 함수 (필수) */
|
|
42
|
-
renderBase: CustomRenderBase<T
|
|
42
|
+
renderBase: CustomRenderBase<T>;
|
|
43
43
|
/** Animation Layer 렌더링 함수 (선택, 애니메이션용) */
|
|
44
|
-
renderAnimation?: CustomRenderAnimation<T
|
|
44
|
+
renderAnimation?: CustomRenderAnimation<T>;
|
|
45
45
|
/** Event Layer 렌더링 함수 (선택) */
|
|
46
|
-
renderEvent?: CustomRenderEvent<T
|
|
47
|
-
/** 렌더링 설정 (색상, 표시 여부, 모양 등) */
|
|
48
|
-
renderConfig?: C;
|
|
46
|
+
renderEvent?: CustomRenderEvent<T>;
|
|
49
47
|
}
|
|
50
48
|
/**
|
|
51
49
|
* POLYGON 타입 Props - 스타일 속성으로 내부 처리
|
|
@@ -80,11 +78,8 @@ interface WoongCanvasLayerPropsForPolygon<T> extends WoongCanvasLayerBaseProps<T
|
|
|
80
78
|
}
|
|
81
79
|
/**
|
|
82
80
|
* 최종 Props 타입 - Discriminated Union
|
|
83
|
-
*
|
|
84
|
-
* @template T 데이터 타입
|
|
85
|
-
* @template C 렌더링 설정 타입 (MARKER 모드에서만 사용)
|
|
86
81
|
*/
|
|
87
|
-
export declare type WoongCanvasLayerProps<T
|
|
82
|
+
export declare type WoongCanvasLayerProps<T> = WoongCanvasLayerPropsForMarker<T> | WoongCanvasLayerPropsForPolygon<T>;
|
|
88
83
|
/**
|
|
89
84
|
* 🚀 WoongCanvasLayer - Konva 기반 초고성능 마커/폴리곤 렌더링 컴포넌트
|
|
90
85
|
*
|
|
@@ -163,5 +158,5 @@ export declare type WoongCanvasLayerProps<T, C = any> = WoongCanvasLayerPropsFor
|
|
|
163
158
|
*
|
|
164
159
|
* @see {@link https://github.com/your-repo/docs/WoongCanvasLayer.md} 전체 문서
|
|
165
160
|
*/
|
|
166
|
-
declare const WoongCanvasLayer: <T
|
|
161
|
+
declare const WoongCanvasLayer: <T>(props: WoongCanvasLayerProps<T>) => React.ReactPortal;
|
|
167
162
|
export default WoongCanvasLayer;
|
|
@@ -78,9 +78,6 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
78
78
|
/** 상호작용 비활성화 상태 (Ref로 관리하여 클로저 문제 해결) */
|
|
79
79
|
|
|
80
80
|
var disableInteractionRef = React.useRef(disableInteraction);
|
|
81
|
-
/** 렌더링 설정 (Ref로 관리하여 클로저 문제 해결) */
|
|
82
|
-
|
|
83
|
-
var renderConfigRef = React.useRef(dataType === types.CanvasDataType.MARKER ? props.renderConfig : undefined);
|
|
84
81
|
/** 현재 Hover 중인 항목 */
|
|
85
82
|
|
|
86
83
|
var hoveredItemRef = React.useRef(null);
|
|
@@ -383,8 +380,7 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
383
380
|
ctx: ctx,
|
|
384
381
|
items: visibleMarkers,
|
|
385
382
|
selectedIds: selectedIdsRef.current,
|
|
386
|
-
utils: renderUtils
|
|
387
|
-
config: renderConfigRef.current
|
|
383
|
+
utils: renderUtils
|
|
388
384
|
});
|
|
389
385
|
},
|
|
390
386
|
perfectDrawEnabled: false,
|
|
@@ -414,8 +410,7 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
414
410
|
layer: layer,
|
|
415
411
|
selectedIds: selectedIdsRef.current,
|
|
416
412
|
items: markersRef.current,
|
|
417
|
-
utils: renderUtils
|
|
418
|
-
config: renderConfigRef.current
|
|
413
|
+
utils: renderUtils
|
|
419
414
|
});
|
|
420
415
|
};
|
|
421
416
|
/**
|
|
@@ -456,8 +451,7 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
456
451
|
hoveredItem: hoveredItemRef.current,
|
|
457
452
|
utils: renderUtils,
|
|
458
453
|
selectedItems: selectedItems,
|
|
459
|
-
selectedItem: selectedItemRef.current
|
|
460
|
-
config: renderConfigRef.current
|
|
454
|
+
selectedItem: selectedItemRef.current
|
|
461
455
|
});
|
|
462
456
|
},
|
|
463
457
|
perfectDrawEnabled: false,
|
|
@@ -969,18 +963,6 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
969
963
|
React.useEffect(function () {
|
|
970
964
|
disableInteractionRef.current = disableInteraction;
|
|
971
965
|
}, [disableInteraction]); // --------------------------------------------------------------------------
|
|
972
|
-
// Lifecycle: renderConfig 동기화
|
|
973
|
-
// --------------------------------------------------------------------------
|
|
974
|
-
|
|
975
|
-
React.useEffect(function () {
|
|
976
|
-
if (dataType === types.CanvasDataType.MARKER) {
|
|
977
|
-
renderConfigRef.current = props.renderConfig; // config 변경 시 렌더링 업데이트
|
|
978
|
-
|
|
979
|
-
doRenderBase();
|
|
980
|
-
doRenderAnimation();
|
|
981
|
-
doRenderEvent();
|
|
982
|
-
}
|
|
983
|
-
}, [dataType === types.CanvasDataType.MARKER ? props.renderConfig : undefined]); // --------------------------------------------------------------------------
|
|
984
966
|
// Lifecycle: 외부 selectedItems 동기화
|
|
985
967
|
// --------------------------------------------------------------------------
|
|
986
968
|
|
|
@@ -1161,22 +1143,21 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
1161
1143
|
|
|
1162
1144
|
|
|
1163
1145
|
var WoongCanvasLayer = React__default["default"].memo(WoongCanvasLayerComponent, function (prevProps, nextProps) {
|
|
1164
|
-
// 1. data 비교
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
if (prevData !== nextData) {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1146
|
+
// // 1. data 비교
|
|
1147
|
+
// const prevData = prevProps.data;
|
|
1148
|
+
// const nextData = nextProps.data;
|
|
1149
|
+
// // 참조가 같으면 스킵
|
|
1150
|
+
// if (prevData !== nextData) {
|
|
1151
|
+
// // 길이가 다르면 변경됨
|
|
1152
|
+
// if (prevData.length !== nextData.length) return false;
|
|
1153
|
+
// // 각 데이터의 ID 비교
|
|
1154
|
+
// for (let i = 0; i < prevData.length; i++) {
|
|
1155
|
+
// if (prevData[i].id !== nextData[i].id) {
|
|
1156
|
+
// return false; // 변경됨 → 리렌더링
|
|
1157
|
+
// }
|
|
1158
|
+
// }
|
|
1159
|
+
// }
|
|
1160
|
+
// 2. selectedItems 비교 (참조만 비교)
|
|
1180
1161
|
if (prevProps.selectedItems !== nextProps.selectedItems) {
|
|
1181
1162
|
return false; // 변경됨 → 리렌더링
|
|
1182
1163
|
}
|
|
@@ -30,7 +30,7 @@ export declare const drawPolygon: ({ ctx, polygonOffsets, isDonutPolygon, fillCo
|
|
|
30
30
|
* 2
|
|
31
31
|
* );
|
|
32
32
|
*/
|
|
33
|
-
export declare const renderPolygonBase: <T = any>(baseFillColor: string, baseStrokeColor: string, baseLineWidth: number) => CustomRenderBase<KonvaCanvasData<T
|
|
33
|
+
export declare const renderPolygonBase: <T = any>(baseFillColor: string, baseStrokeColor: string, baseLineWidth: number) => CustomRenderBase<KonvaCanvasData<T>>;
|
|
34
34
|
/**
|
|
35
35
|
* 폴리곤 Event 렌더링 함수
|
|
36
36
|
*
|
|
@@ -56,4 +56,4 @@ export declare const renderPolygonBase: <T = any>(baseFillColor: string, baseStr
|
|
|
56
56
|
* 'rgba(100, 150, 255, 0.8)'
|
|
57
57
|
* );
|
|
58
58
|
*/
|
|
59
|
-
export declare const renderPolygonEvent: <T = any>(selectedFillColor: string, selectedStrokeColor: string, selectedLineWidth: number, activeFillColor?: string, activeStrokeColor?: string, activeLineWidth?: number, hoveredFillColor?: string, hoveredStrokeColor?: string, hoveredLineWidth?: number) => CustomRenderEvent<KonvaCanvasData<T
|
|
59
|
+
export declare const renderPolygonEvent: <T = any>(selectedFillColor: string, selectedStrokeColor: string, selectedLineWidth: number, activeFillColor?: string, activeStrokeColor?: string, activeLineWidth?: number, hoveredFillColor?: string, hoveredStrokeColor?: string, hoveredLineWidth?: number) => CustomRenderEvent<KonvaCanvasData<T>>;
|
|
@@ -142,11 +142,8 @@ export interface RenderUtils<T> {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 커스텀 렌더링 함수 파라미터 - Base Layer
|
|
145
|
-
*
|
|
146
|
-
* @template T 데이터 타입
|
|
147
|
-
* @template C 설정(Config) 타입 (선택)
|
|
148
145
|
*/
|
|
149
|
-
export interface RenderBaseParams<T
|
|
146
|
+
export interface RenderBaseParams<T> {
|
|
150
147
|
/** Canvas 2D 렌더링 컨텍스트 (순수 Canvas API) */
|
|
151
148
|
ctx: CanvasRenderingContext2D;
|
|
152
149
|
/** 렌더링할 마커 데이터 배열 */
|
|
@@ -155,56 +152,26 @@ export interface RenderBaseParams<T, C = any> {
|
|
|
155
152
|
selectedIds: Set<string>;
|
|
156
153
|
/** 렌더링 유틸리티 함수들 */
|
|
157
154
|
utils: RenderUtils<T>;
|
|
158
|
-
/** 렌더링 설정 (색상, 표시 여부, 모양 등) */
|
|
159
|
-
config?: C;
|
|
160
155
|
}
|
|
161
156
|
/**
|
|
162
157
|
* 커스텀 렌더링 함수 타입 - Base Layer
|
|
163
158
|
*
|
|
164
159
|
* 🔥 순수 Canvas API 사용 (Konva 지식 불필요!)
|
|
165
160
|
*
|
|
166
|
-
* @template T 데이터 타입
|
|
167
|
-
* @template C 설정(Config) 타입 - 렌더링 옵션 (색상, 표시 여부, 모양 등)
|
|
168
|
-
*
|
|
169
161
|
* @example
|
|
170
|
-
*
|
|
171
|
-
* const renderBase: CustomRenderBase<Marker> = ({ ctx, items, selectedIds, utils }) => {
|
|
162
|
+
* const renderBase = ({ ctx, items, selectedIds, utils }) => {
|
|
172
163
|
* for (const item of items) {
|
|
173
164
|
* if (selectedIds.has(item.id)) continue;
|
|
174
165
|
* const pos = utils.getOrComputeMarkerOffset(item);
|
|
175
|
-
* ctx.fillRect(pos.x, pos.y, 50, 50);
|
|
176
|
-
* }
|
|
177
|
-
* };
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* // config 사용
|
|
181
|
-
* interface MarkerRenderConfig {
|
|
182
|
-
* showLabel: boolean;
|
|
183
|
-
* color: string;
|
|
184
|
-
* shape: 'circle' | 'square';
|
|
185
|
-
* }
|
|
186
|
-
*
|
|
187
|
-
* const renderBase: CustomRenderBase<Marker, MarkerRenderConfig> = ({ ctx, items, config, utils }) => {
|
|
188
|
-
* for (const item of items) {
|
|
189
|
-
* const pos = utils.getOrComputeMarkerOffset(item);
|
|
190
|
-
* ctx.fillStyle = config?.color || 'blue';
|
|
191
|
-
* if (config?.shape === 'circle') {
|
|
192
|
-
* ctx.arc(pos.x, pos.y, 10, 0, Math.PI * 2);
|
|
193
|
-
* } else {
|
|
194
|
-
* ctx.fillRect(pos.x, pos.y, 20, 20);
|
|
195
|
-
* }
|
|
196
|
-
* ctx.fill();
|
|
166
|
+
* ctx.fillRect(pos.x, pos.y, 50, 50); // 순수 Canvas API!
|
|
197
167
|
* }
|
|
198
168
|
* };
|
|
199
169
|
*/
|
|
200
|
-
export declare type CustomRenderBase<T
|
|
170
|
+
export declare type CustomRenderBase<T> = (params: RenderBaseParams<T>) => void;
|
|
201
171
|
/**
|
|
202
172
|
* 커스텀 렌더링 함수 파라미터 - Animation Layer
|
|
203
|
-
*
|
|
204
|
-
* @template T 데이터 타입
|
|
205
|
-
* @template C 설정(Config) 타입 (선택)
|
|
206
173
|
*/
|
|
207
|
-
export interface RenderAnimationParams<T
|
|
174
|
+
export interface RenderAnimationParams<T> {
|
|
208
175
|
/** Konva Layer 인스턴스 */
|
|
209
176
|
layer: Konva.Layer;
|
|
210
177
|
/** 현재 선택된 마커 ID Set */
|
|
@@ -213,35 +180,23 @@ export interface RenderAnimationParams<T, C = any> {
|
|
|
213
180
|
items: KonvaCanvasData<T>[];
|
|
214
181
|
/** 렌더링 유틸리티 함수들 */
|
|
215
182
|
utils: RenderUtils<T>;
|
|
216
|
-
/** 렌더링 설정 (애니메이션 속도, 효과 등) */
|
|
217
|
-
config?: C;
|
|
218
183
|
}
|
|
219
184
|
/**
|
|
220
185
|
* 커스텀 렌더링 함수 타입 - Animation Layer (선택)
|
|
221
186
|
*
|
|
222
|
-
* @template T 데이터 타입
|
|
223
|
-
* @template C 설정(Config) 타입 - 애니메이션 옵션
|
|
224
|
-
*
|
|
225
187
|
* @example
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* const renderAnimation: CustomRenderAnimation<Marker, AnimationConfig> = ({ layer, selectedIds, items, config, utils }) => {
|
|
233
|
-
* const bounceHeight = config?.bounceHeight || 15;
|
|
234
|
-
* // Konva 애니메이션 구현
|
|
188
|
+
* const renderAnimation = ({ layer, selectedIds, items, utils }) => {
|
|
189
|
+
* for (const id of selectedIds) {
|
|
190
|
+
* const item = items.find(i => i.id === id);
|
|
191
|
+
* // Konva 애니메이션 구현
|
|
192
|
+
* }
|
|
235
193
|
* };
|
|
236
194
|
*/
|
|
237
|
-
export declare type CustomRenderAnimation<T
|
|
195
|
+
export declare type CustomRenderAnimation<T> = (params: RenderAnimationParams<T>) => void;
|
|
238
196
|
/**
|
|
239
197
|
* 커스텀 렌더링 함수 파라미터 - Event Layer
|
|
240
|
-
*
|
|
241
|
-
* @template T 데이터 타입
|
|
242
|
-
* @template C 설정(Config) 타입 (선택)
|
|
243
198
|
*/
|
|
244
|
-
export interface RenderEventParams<T
|
|
199
|
+
export interface RenderEventParams<T> {
|
|
245
200
|
/** Canvas 2D 렌더링 컨텍스트 (순수 Canvas API) */
|
|
246
201
|
ctx: CanvasRenderingContext2D;
|
|
247
202
|
/** 현재 hover된 마커 데이터 */
|
|
@@ -252,30 +207,19 @@ export interface RenderEventParams<T, C = any> {
|
|
|
252
207
|
selectedItems?: KonvaCanvasData<T>[];
|
|
253
208
|
/** 외부에서 전달된 단일 선택 아이템 (특별한 효과용) */
|
|
254
209
|
selectedItem?: KonvaCanvasData<T> | null;
|
|
255
|
-
/** 렌더링 설정 (hover 색상, 선택 효과 등) */
|
|
256
|
-
config?: C;
|
|
257
210
|
}
|
|
258
211
|
/**
|
|
259
212
|
* 커스텀 렌더링 함수 타입 - Event Layer
|
|
260
213
|
*
|
|
261
214
|
* 🔥 순수 Canvas API 사용 (Konva 지식 불필요!)
|
|
262
215
|
*
|
|
263
|
-
* @template T 데이터 타입
|
|
264
|
-
* @template C 설정(Config) 타입 - 이벤트 렌더링 옵션
|
|
265
|
-
*
|
|
266
216
|
* @example
|
|
267
|
-
*
|
|
268
|
-
* interface EventRenderConfig {
|
|
269
|
-
* hoverColor: string;
|
|
270
|
-
* selectedColor: string;
|
|
271
|
-
* }
|
|
272
|
-
*
|
|
273
|
-
* const renderEvent: CustomRenderEvent<Marker, EventRenderConfig> = ({ ctx, hoveredItem, config, utils }) => {
|
|
217
|
+
* const renderEvent = ({ ctx, hoveredItem, utils, selectedItems }) => {
|
|
274
218
|
* if (hoveredItem) {
|
|
275
219
|
* const pos = utils.getOrComputeMarkerOffset(hoveredItem);
|
|
276
|
-
* ctx.fillStyle =
|
|
277
|
-
* ctx.fillRect(pos.x, pos.y, 50, 50);
|
|
220
|
+
* ctx.fillStyle = 'red';
|
|
221
|
+
* ctx.fillRect(pos.x, pos.y, 50, 50); // 순수 Canvas API!
|
|
278
222
|
* }
|
|
279
223
|
* };
|
|
280
224
|
*/
|
|
281
|
-
export declare type CustomRenderEvent<T
|
|
225
|
+
export declare type CustomRenderEvent<T> = (params: RenderEventParams<T>) => void;
|
package/dist/index.es.js
CHANGED
|
@@ -5690,9 +5690,6 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
5690
5690
|
/** 상호작용 비활성화 상태 (Ref로 관리하여 클로저 문제 해결) */
|
|
5691
5691
|
|
|
5692
5692
|
var disableInteractionRef = useRef(disableInteraction);
|
|
5693
|
-
/** 렌더링 설정 (Ref로 관리하여 클로저 문제 해결) */
|
|
5694
|
-
|
|
5695
|
-
var renderConfigRef = useRef(dataType === CanvasDataType.MARKER ? props.renderConfig : undefined);
|
|
5696
5693
|
/** 현재 Hover 중인 항목 */
|
|
5697
5694
|
|
|
5698
5695
|
var hoveredItemRef = useRef(null);
|
|
@@ -5995,8 +5992,7 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
5995
5992
|
ctx: ctx,
|
|
5996
5993
|
items: visibleMarkers,
|
|
5997
5994
|
selectedIds: selectedIdsRef.current,
|
|
5998
|
-
utils: renderUtils
|
|
5999
|
-
config: renderConfigRef.current
|
|
5995
|
+
utils: renderUtils
|
|
6000
5996
|
});
|
|
6001
5997
|
},
|
|
6002
5998
|
perfectDrawEnabled: false,
|
|
@@ -6026,8 +6022,7 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
6026
6022
|
layer: layer,
|
|
6027
6023
|
selectedIds: selectedIdsRef.current,
|
|
6028
6024
|
items: markersRef.current,
|
|
6029
|
-
utils: renderUtils
|
|
6030
|
-
config: renderConfigRef.current
|
|
6025
|
+
utils: renderUtils
|
|
6031
6026
|
});
|
|
6032
6027
|
};
|
|
6033
6028
|
/**
|
|
@@ -6068,8 +6063,7 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
6068
6063
|
hoveredItem: hoveredItemRef.current,
|
|
6069
6064
|
utils: renderUtils,
|
|
6070
6065
|
selectedItems: selectedItems,
|
|
6071
|
-
selectedItem: selectedItemRef.current
|
|
6072
|
-
config: renderConfigRef.current
|
|
6066
|
+
selectedItem: selectedItemRef.current
|
|
6073
6067
|
});
|
|
6074
6068
|
},
|
|
6075
6069
|
perfectDrawEnabled: false,
|
|
@@ -6581,18 +6575,6 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
6581
6575
|
useEffect(function () {
|
|
6582
6576
|
disableInteractionRef.current = disableInteraction;
|
|
6583
6577
|
}, [disableInteraction]); // --------------------------------------------------------------------------
|
|
6584
|
-
// Lifecycle: renderConfig 동기화
|
|
6585
|
-
// --------------------------------------------------------------------------
|
|
6586
|
-
|
|
6587
|
-
useEffect(function () {
|
|
6588
|
-
if (dataType === CanvasDataType.MARKER) {
|
|
6589
|
-
renderConfigRef.current = props.renderConfig; // config 변경 시 렌더링 업데이트
|
|
6590
|
-
|
|
6591
|
-
doRenderBase();
|
|
6592
|
-
doRenderAnimation();
|
|
6593
|
-
doRenderEvent();
|
|
6594
|
-
}
|
|
6595
|
-
}, [dataType === CanvasDataType.MARKER ? props.renderConfig : undefined]); // --------------------------------------------------------------------------
|
|
6596
6578
|
// Lifecycle: 외부 selectedItems 동기화
|
|
6597
6579
|
// --------------------------------------------------------------------------
|
|
6598
6580
|
|
|
@@ -6773,22 +6755,21 @@ var WoongCanvasLayerComponent = function (props) {
|
|
|
6773
6755
|
|
|
6774
6756
|
|
|
6775
6757
|
var WoongCanvasLayer = React.memo(WoongCanvasLayerComponent, function (prevProps, nextProps) {
|
|
6776
|
-
// 1. data 비교
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
if (prevData !== nextData) {
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6758
|
+
// // 1. data 비교
|
|
6759
|
+
// const prevData = prevProps.data;
|
|
6760
|
+
// const nextData = nextProps.data;
|
|
6761
|
+
// // 참조가 같으면 스킵
|
|
6762
|
+
// if (prevData !== nextData) {
|
|
6763
|
+
// // 길이가 다르면 변경됨
|
|
6764
|
+
// if (prevData.length !== nextData.length) return false;
|
|
6765
|
+
// // 각 데이터의 ID 비교
|
|
6766
|
+
// for (let i = 0; i < prevData.length; i++) {
|
|
6767
|
+
// if (prevData[i].id !== nextData[i].id) {
|
|
6768
|
+
// return false; // 변경됨 → 리렌더링
|
|
6769
|
+
// }
|
|
6770
|
+
// }
|
|
6771
|
+
// }
|
|
6772
|
+
// 2. selectedItems 비교 (참조만 비교)
|
|
6792
6773
|
if (prevProps.selectedItems !== nextProps.selectedItems) {
|
|
6793
6774
|
return false; // 변경됨 → 리렌더링
|
|
6794
6775
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -5694,9 +5694,6 @@
|
|
|
5694
5694
|
/** 상호작용 비활성화 상태 (Ref로 관리하여 클로저 문제 해결) */
|
|
5695
5695
|
|
|
5696
5696
|
var disableInteractionRef = React.useRef(disableInteraction);
|
|
5697
|
-
/** 렌더링 설정 (Ref로 관리하여 클로저 문제 해결) */
|
|
5698
|
-
|
|
5699
|
-
var renderConfigRef = React.useRef(dataType === exports.CanvasDataType.MARKER ? props.renderConfig : undefined);
|
|
5700
5697
|
/** 현재 Hover 중인 항목 */
|
|
5701
5698
|
|
|
5702
5699
|
var hoveredItemRef = React.useRef(null);
|
|
@@ -5999,8 +5996,7 @@
|
|
|
5999
5996
|
ctx: ctx,
|
|
6000
5997
|
items: visibleMarkers,
|
|
6001
5998
|
selectedIds: selectedIdsRef.current,
|
|
6002
|
-
utils: renderUtils
|
|
6003
|
-
config: renderConfigRef.current
|
|
5999
|
+
utils: renderUtils
|
|
6004
6000
|
});
|
|
6005
6001
|
},
|
|
6006
6002
|
perfectDrawEnabled: false,
|
|
@@ -6030,8 +6026,7 @@
|
|
|
6030
6026
|
layer: layer,
|
|
6031
6027
|
selectedIds: selectedIdsRef.current,
|
|
6032
6028
|
items: markersRef.current,
|
|
6033
|
-
utils: renderUtils
|
|
6034
|
-
config: renderConfigRef.current
|
|
6029
|
+
utils: renderUtils
|
|
6035
6030
|
});
|
|
6036
6031
|
};
|
|
6037
6032
|
/**
|
|
@@ -6072,8 +6067,7 @@
|
|
|
6072
6067
|
hoveredItem: hoveredItemRef.current,
|
|
6073
6068
|
utils: renderUtils,
|
|
6074
6069
|
selectedItems: selectedItems,
|
|
6075
|
-
selectedItem: selectedItemRef.current
|
|
6076
|
-
config: renderConfigRef.current
|
|
6070
|
+
selectedItem: selectedItemRef.current
|
|
6077
6071
|
});
|
|
6078
6072
|
},
|
|
6079
6073
|
perfectDrawEnabled: false,
|
|
@@ -6585,18 +6579,6 @@
|
|
|
6585
6579
|
React.useEffect(function () {
|
|
6586
6580
|
disableInteractionRef.current = disableInteraction;
|
|
6587
6581
|
}, [disableInteraction]); // --------------------------------------------------------------------------
|
|
6588
|
-
// Lifecycle: renderConfig 동기화
|
|
6589
|
-
// --------------------------------------------------------------------------
|
|
6590
|
-
|
|
6591
|
-
React.useEffect(function () {
|
|
6592
|
-
if (dataType === exports.CanvasDataType.MARKER) {
|
|
6593
|
-
renderConfigRef.current = props.renderConfig; // config 변경 시 렌더링 업데이트
|
|
6594
|
-
|
|
6595
|
-
doRenderBase();
|
|
6596
|
-
doRenderAnimation();
|
|
6597
|
-
doRenderEvent();
|
|
6598
|
-
}
|
|
6599
|
-
}, [dataType === exports.CanvasDataType.MARKER ? props.renderConfig : undefined]); // --------------------------------------------------------------------------
|
|
6600
6582
|
// Lifecycle: 외부 selectedItems 동기화
|
|
6601
6583
|
// --------------------------------------------------------------------------
|
|
6602
6584
|
|
|
@@ -6777,22 +6759,21 @@
|
|
|
6777
6759
|
|
|
6778
6760
|
|
|
6779
6761
|
var WoongCanvasLayer = React__default["default"].memo(WoongCanvasLayerComponent, function (prevProps, nextProps) {
|
|
6780
|
-
// 1. data 비교
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
if (prevData !== nextData) {
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6762
|
+
// // 1. data 비교
|
|
6763
|
+
// const prevData = prevProps.data;
|
|
6764
|
+
// const nextData = nextProps.data;
|
|
6765
|
+
// // 참조가 같으면 스킵
|
|
6766
|
+
// if (prevData !== nextData) {
|
|
6767
|
+
// // 길이가 다르면 변경됨
|
|
6768
|
+
// if (prevData.length !== nextData.length) return false;
|
|
6769
|
+
// // 각 데이터의 ID 비교
|
|
6770
|
+
// for (let i = 0; i < prevData.length; i++) {
|
|
6771
|
+
// if (prevData[i].id !== nextData[i].id) {
|
|
6772
|
+
// return false; // 변경됨 → 리렌더링
|
|
6773
|
+
// }
|
|
6774
|
+
// }
|
|
6775
|
+
// }
|
|
6776
|
+
// 2. selectedItems 비교 (참조만 비교)
|
|
6796
6777
|
if (prevProps.selectedItems !== nextProps.selectedItems) {
|
|
6797
6778
|
return false; // 변경됨 → 리렌더링
|
|
6798
6779
|
}
|