polarvo-layout 1.0.18 → 1.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polarvo-layout",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "type": "module",
5
5
  "author": "unigence <unigencelab@gmail.com>",
6
6
  "repository": {
@@ -31,8 +31,8 @@ const props = defineProps({
31
31
  const { activeDesign } = toRefs(props.polarvo.display.state);
32
32
  const { setActiveDesign } = props.polarvo.display;
33
33
 
34
- const { activeData, activeSection } = toRefs(props.polarvo.layout.state);
35
- const sectionMode = computed(() => activeData.value?.mode);
34
+ const { activeMode, activeSection } = toRefs(props.polarvo.layout.state);
35
+ const sectionMode = computed(() => activeMode.value);
36
36
 
37
37
  const { activeElement: freeActiveElement } = toRefs(props.polarvo.freeDrop.state);
38
38
  const { activeElement: gridActiveElement } = toRefs(props.polarvo.gridDrop.state);
@@ -18,7 +18,7 @@
18
18
  <div class="text-sm">보조선 표시</div>
19
19
  <input
20
20
  type="checkbox"
21
- :checked="activeData?.config?.showGuideLine"
21
+ :checked="activeConfig?.showGuideLine"
22
22
  @change="setSectionConfig('guideLine', $event.target.checked)"
23
23
  />
24
24
  </div>
@@ -33,7 +33,7 @@
33
33
  min="1"
34
34
  max="50"
35
35
  class="text-sm text-center w-6 border-b-2 border-white focus:outline-none focus:border-b-2 focus:border-blue-500"
36
- :value="activeData?.config?.gridRows"
36
+ :value="activeConfig?.gridRows"
37
37
  @change="setSectionConfig('row', $event.target.value)"
38
38
  />
39
39
  </div>
@@ -45,7 +45,7 @@
45
45
  min="1"
46
46
  max="12"
47
47
  class="text-sm text-center w-6 border-b-2 border-white focus:outline-none focus:border-b-2 focus:border-blue-500"
48
- :value="activeData?.config?.gridColumns"
48
+ :value="activeConfig?.gridColumns"
49
49
  @change="setSectionConfig('column', $event.target.value)"
50
50
  />
51
51
  </div>
@@ -57,7 +57,7 @@
57
57
  min="0"
58
58
  max="12"
59
59
  class="text-sm text-center w-6 border-b-2 border-white focus:outline-none focus:border-b-2 focus:border-blue-500"
60
- :value="activeData?.config?.gridGap"
60
+ :value="activeConfig?.gridGap"
61
61
  @change="setSectionConfig('gap', $event.target.value)"
62
62
  />
63
63
  </div>
@@ -77,9 +77,9 @@ const props = defineProps({
77
77
  },
78
78
  });
79
79
 
80
- const { activeSection, activeData } = toRefs(props.polarvo.layout.state);
80
+ const { activeSection, activeMode, activeConfig } = toRefs(props.polarvo.layout.state);
81
81
  const { setSectionMode, setSectionConfig } = props.polarvo.layout;
82
- const sectionMode = computed(() => activeData.value?.mode);
82
+ const sectionMode = computed(() => activeMode.value);
83
83
  </script>
84
84
 
85
85
  <style scoped lang="scss">
@@ -29,8 +29,8 @@ const props = defineProps({
29
29
  const { addElement: addElementToFree } = props.polarvo.freeDrop;
30
30
  const { addElement: addElementToGrid } = props.polarvo.gridDrop;
31
31
 
32
- const { activeData } = toRefs(props.polarvo.layout.state);
33
- const sectionMode = computed(() => activeData.value?.mode);
32
+ const { activeMode } = toRefs(props.polarvo.layout.state);
33
+ const sectionMode = computed(() => activeMode.value);
34
34
 
35
35
  const allElements = ref([]);
36
36
 
@@ -25,7 +25,7 @@
25
25
  id="row-count"
26
26
  min="1"
27
27
  max="50"
28
- :value="activeData?.config?.gridRows"
28
+ :value="activeConfig.gridRows"
29
29
  @change="setSectionConfig('row', $event.target.value)"
30
30
  />
31
31
  </div>
@@ -37,7 +37,7 @@
37
37
  id="column-count"
38
38
  min="1"
39
39
  max="12"
40
- :value="activeData?.config?.gridColumns"
40
+ :value="activeConfig.gridColumns"
41
41
  @change="setSectionConfig('column', $event.target.value)"
42
42
  />
43
43
  </div>
@@ -49,7 +49,7 @@
49
49
  id="gap-size"
50
50
  min="0"
51
51
  max="12"
52
- :value="activeData?.config?.gridGap"
52
+ :value="activeConfig.gridGap"
53
53
  @change="setSectionConfig('gap', $event.target.value)"
54
54
  />
55
55
  </div>
@@ -63,7 +63,7 @@
63
63
  class="text-sm w-4 h-4 border-b-2 border-white focus:outline-none focus:border-b-2 focus:border-blue-500"
64
64
  type="checkbox"
65
65
  id="guide-line"
66
- :checked="activeData?.config?.showGuideLine"
66
+ :checked="activeConfig.showGuideLine"
67
67
  @change="setSectionConfig('guideLine', $event.target.checked)"
68
68
  />
69
69
  </div>
@@ -81,10 +81,10 @@ const props = defineProps({
81
81
  required: true,
82
82
  },
83
83
  });
84
- const { activeData } = toRefs(props.polarvo.layout.state);
84
+ const { activeMode, activeConfig } = toRefs(props.polarvo.layout.state);
85
85
  const { setSectionMode, setSectionConfig } = props.polarvo.layout;
86
86
 
87
- const sectionMode = computed(() => activeData.value?.mode);
87
+ const sectionMode = computed(() => activeMode.value);
88
88
  </script>
89
89
 
90
90
  <style lang="scss" scoped></style>
@@ -4,6 +4,7 @@ const createDefaultConfig = (overrides = {}) => {
4
4
  return {
5
5
  initialState: {
6
6
  elements: [], // 요소들
7
+ layoutData: null, // 레이아웃 데이터
7
8
  activeSection: null,
8
9
  },
9
10
  resource: {
@@ -1,5 +1,3 @@
1
- import { omit } from 'lodash-es';
2
-
3
1
  // event 발행 시 'display'으로 시작하는 이름 사용
4
2
  class DisplayEngine {
5
3
  constructor({ eventBus, options }) {
@@ -34,17 +32,7 @@ class DisplayEngine {
34
32
  this._resetDisplaySizeByMode(this.displayMode);
35
33
 
36
34
  this.eventBus.emit('display:engineInitialized', {
37
- displaySize: this.displaySize,
38
- timestamp: Date.now(),
39
- });
40
- });
41
-
42
- this._subscribe('system:enginesReset', () => {
43
- this.displayMode = 'desktop';
44
- this._resetDisplaySizeByMode(this.displayMode);
45
-
46
- this.eventBus.emit('display:enginesReset', {
47
- displaySize: this.displaySize,
35
+ $displaySize: this.displaySize,
48
36
  timestamp: Date.now(),
49
37
  });
50
38
  });
@@ -54,15 +42,9 @@ class DisplayEngine {
54
42
  this.setActiveDesign(null);
55
43
  });
56
44
 
57
- this._subscribe('layout:setLayoutName', ({ screenConfig }) => {
58
- this.displayMode = screenConfig.displayMode;
59
- this.displaySize = { ...screenConfig.displaySize };
60
-
61
- this.eventBus.emit('display:setLayoutName', {
62
- displayMode: this.displayMode,
63
- displaySize: this.displaySize,
64
- timestamp: Date.now(),
65
- });
45
+ this._subscribe('layout:setLayoutName', ({ $screenConfig }) => {
46
+ this.displayMode = $screenConfig.displayMode;
47
+ this.displaySize = { ...$screenConfig.displaySize };
66
48
  });
67
49
 
68
50
  this._subscribe('freeDrop:startDrag', () => {
@@ -72,19 +54,29 @@ class DisplayEngine {
72
54
 
73
55
  this._subscribe('gridDrop:setActiveElement', ({ action }) => {
74
56
  if (action === 'update') return;
75
- // if (action === 'click') {
76
- // this.setActiveMenu('element');
77
- // } else {
78
- this.setActiveMenu(null);
79
- // }
80
-
57
+ this.setActiveMenu(null);
81
58
  this.setActiveDesign(null);
82
59
  });
83
60
 
84
61
  this._subscribe('gridDrop:requestOpenElementBar', () => {
85
62
  this.setActiveMenu('element');
86
63
  this.setActiveDesign(null);
87
- })
64
+ });
65
+ }
66
+
67
+ /** 엔진 초기화 */
68
+ reset() {
69
+ this.activeMenu = null;
70
+ this.activeDesign = null;
71
+ this.displayMode = 'desktop';
72
+ this._resetDisplaySizeByMode(this.displayMode);
73
+
74
+ console.log('[DisplayEngine] 리셋 완료');
75
+
76
+ this.eventBus.emit('display:enginesReset', {
77
+ $displaySize: this.displaySize,
78
+ timestamp: Date.now(),
79
+ });
88
80
  }
89
81
 
90
82
  /** 삭제 및 정리 */
@@ -95,6 +87,8 @@ class DisplayEngine {
95
87
  }
96
88
  });
97
89
 
90
+ this.reset();
91
+
98
92
  this._subscriptions = [];
99
93
  this.eventBus = null;
100
94
  this.resource = null;
@@ -139,7 +133,7 @@ class DisplayEngine {
139
133
  this.activeMenu = name;
140
134
 
141
135
  this.eventBus.emit('display:updateActiveMenu', {
142
- menu: name,
136
+ $menu: name,
143
137
  timestamp: Date.now(),
144
138
  });
145
139
  }
@@ -152,7 +146,7 @@ class DisplayEngine {
152
146
  this.activeDesign = name;
153
147
 
154
148
  this.eventBus.emit('display:updateActiveDesign', {
155
- design: name,
149
+ $design: name,
156
150
  timestamp: Date.now(),
157
151
  });
158
152
  }
@@ -168,15 +162,16 @@ class DisplayEngine {
168
162
 
169
163
  if (this.displayMode === mode) return;
170
164
 
165
+ const prevDisplayMode = this.displayMode;
171
166
  this.displayMode = mode;
172
167
  const prevDisplaySize = { ...this.displaySize };
173
168
  this._resetDisplaySizeByMode(mode);
174
169
 
175
- // displayMode 변경 시, displaySize도 초기화 됨
176
- this.eventBus.emit('display:updateDisplayMode', {
177
- displayMode: this.displayMode,
178
- displaySize: this.displaySize,
179
- prev: { displaySize: prevDisplaySize },
170
+ this.eventBus.emit('display:displayChanged', {
171
+ type: 'mode',
172
+ $displayMode: this.displayMode,
173
+ $displaySize: this.displaySize,
174
+ prev: { displayMode: prevDisplayMode, displaySize: prevDisplaySize },
180
175
  timestamp: Date.now(),
181
176
  });
182
177
  }
@@ -224,8 +219,10 @@ class DisplayEngine {
224
219
  const prevDisplaySize = { ...this.displaySize };
225
220
  this.displaySize[type] = Math.min(Math.max(0, numSize), typeLimit.max);
226
221
 
227
- this.eventBus.emit('display:updateDisplaySize', {
228
- displaySize: this.displaySize,
222
+ this.eventBus.emit('display:displayChanged', {
223
+ type: 'size',
224
+ $displayMode: this.displayMode,
225
+ $displaySize: this.displaySize,
229
226
  prev: { displaySize: prevDisplaySize },
230
227
  timestamp: Date.now(),
231
228
  });
@@ -14,8 +14,10 @@ class FreeDropEngine {
14
14
  this._elementsUpdate = false; // 원본 요소 목록 변경 플래그
15
15
  this._freeElements = []; // 로컬에서 사용하는 요소 목록
16
16
 
17
- this._activeData = null;
18
17
  this._activeSection = null;
18
+ this._activeMode = null;
19
+ this._activeConfig = null;
20
+
19
21
  this._activeElement = null; // 드래그 중인 배치요소
20
22
 
21
23
  this.guides = { x: null, y: null, w: null, h: null }; // 가이드 라인 위치
@@ -50,43 +52,43 @@ class FreeDropEngine {
50
52
  /** [내부함수] 구독 설정 */
51
53
  _setupSubscriptions() {
52
54
  // 초기화 완료 이벤트 구독 - from DisplayEngine
53
- this._subscribe('display:engineInitialized', ({ displaySize }) => {
54
- const { gridSize } = displaySize;
55
+ this._subscribe('display:engineInitialized', ({ $displaySize }) => {
56
+ const { gridSize } = $displaySize;
55
57
  this._gridSize = gridSize;
56
58
 
57
59
  this._initialize();
58
60
  });
59
61
 
60
- this._subscribe('display:enginesReset', ({ displaySize }) => {
61
- const { gridSize } = displaySize;
62
+ this._subscribe('display:enginesReset', ({ $displaySize }) => {
63
+ const { gridSize } = $displaySize;
62
64
  this._gridSize = gridSize;
63
65
 
64
66
  this._initialize();
65
67
  });
66
68
 
67
69
  // displayMode 변경 감지 (displaySize가 함께 초기화됨)
68
- this._subscribe('display:updateDisplayMode', ({ displaySize }) => {
69
- const { gridSize } = displaySize;
70
+ this._subscribe('display:displayChanged', ({ $displaySize }) => {
71
+ const { gridSize } = $displaySize;
70
72
  this._gridSize = gridSize;
71
73
  });
72
74
 
73
75
  // layoutName 변경 감지 (gridNumber가 함께 초기화됨)
74
- this._subscribe('layout:setLayoutName', ({ gridNumber }) => {
75
- this._gridNumber = gridNumber;
76
+ this._subscribe('layout:setLayoutName', ({ $gridNumber }) => {
77
+ this._gridNumber = $gridNumber;
76
78
  });
77
- this._subscribe('layout:updateLayoutName', ({ gridNumber }) => {
78
- this._gridNumber = gridNumber;
79
+ this._subscribe('layout:updateLayoutName', ({ $gridNumber }) => {
80
+ this._gridNumber = $gridNumber;
79
81
  });
80
82
 
81
- // activeSection 변경 감지 (activeData가 함께 초기화됨)
82
- this._subscribe('system:updateActiveSection', ({ activeSection, activeData }) => {
83
- this._activeSection = activeSection;
84
- this._activeData = activeData;
85
- // this.setActiveElement(null);
83
+ // activeSection 변경 감지
84
+ this._subscribe('system:updateActiveSection', ({ $section, $mode, $config }) => {
85
+ this._activeSection = $section;
86
+ this._activeMode = $mode;
87
+ this._activeConfig = $config;
86
88
  });
87
89
 
88
- this._subscribe('system:setElements', ({ elements }) => {
89
- this._elements = elements;
90
+ this._subscribe('system:setElements', ({ $elements }) => {
91
+ this._elements = $elements;
90
92
  this._elementsUpdate = true;
91
93
 
92
94
  // 활성화 요소 초기화
@@ -98,23 +100,16 @@ class FreeDropEngine {
98
100
  });
99
101
  });
100
102
 
101
- // sectionConfig 변경 감지 (free 모드인 경우에만 activeData 갱신)
102
- this._subscribe('system:updateActiveSectionConfig', ({ activeData }) => {
103
- if (activeData?.mode == 'free') {
104
- this._activeData = activeData;
105
- }
103
+ this._subscribe('layout:updateLayoutData', ({ $mode, $config }) => {
104
+ this._activeMode = $mode;
105
+ this._activeConfig = $config;
106
106
  });
107
107
 
108
- this._subscribe('system:requestUpdateData', ({ elements, elementId, activeData }) => {
109
- this._elements = elements;
108
+ this._subscribe('system:requestUpdateElement', ({ $elements, $elementId }) => {
109
+ this._elements = $elements;
110
110
  this._elementsUpdate = true;
111
111
 
112
- this.setActiveElement(this._elements.find((x) => x.id === elementId));
113
-
114
- if (activeData?.mode == 'free') {
115
- this._activeData = activeData;
116
- }
117
-
112
+ this.setActiveElement(this._elements.find((x) => x.id === $elementId));
118
113
  this.eventBus.emit('freeDrop:requestUpdateData', {
119
114
  elements: cloneDeep(this.freeElements),
120
115
  guides: this.guides,
@@ -138,8 +133,8 @@ class FreeDropEngine {
138
133
  });
139
134
  });
140
135
 
141
- this._subscribe('system:requestUpdateElements', ({ elements }) => {
142
- this._elements = elements;
136
+ this._subscribe('system:requestElementsScale', ({ $elements }) => {
137
+ this._elements = $elements;
143
138
  this._elementsUpdate = true;
144
139
  });
145
140
 
@@ -155,6 +150,12 @@ class FreeDropEngine {
155
150
  });
156
151
  }
157
152
 
153
+ /** 엔진 초기화 */
154
+ reset() {
155
+ this._initialize();
156
+ console.log('[FreeDropEngine] 리셋 완료');
157
+ }
158
+
158
159
  /** 삭제 및 정리 */
159
160
  destroy() {
160
161
  this._subscriptions.forEach((unsubscribe) => {
@@ -163,7 +164,8 @@ class FreeDropEngine {
163
164
  }
164
165
  });
165
166
 
166
- this._initialize();
167
+ this.reset();
168
+
167
169
  this._subscriptions = [];
168
170
  this.eventBus = null;
169
171
  this.resource = null;
@@ -223,8 +225,9 @@ class FreeDropEngine {
223
225
  this._startSize = { w: 0, h: 0 };
224
226
  this._offsetPos = { x: 0, y: 0 };
225
227
 
226
- this._activeData = null;
227
228
  this._activeSection = null;
229
+ this._activeMode = null;
230
+ this._activeConfig = null;
228
231
  this._activeElement = null;
229
232
  this._alreadyExist = false;
230
233
 
@@ -309,8 +312,8 @@ class FreeDropEngine {
309
312
  * @return {boolean} - 가이드라인 표시 여부
310
313
  */
311
314
  _getGuideLineConfig() {
312
- if (this._activeData && this._activeData.config) {
313
- return this._activeData?.config?.showGuideLine;
315
+ if (this._activeConfig) {
316
+ return this._activeConfig?.showGuideLine;
314
317
  } else {
315
318
  return false;
316
319
  }
@@ -337,11 +340,7 @@ class FreeDropEngine {
337
340
  * @param {string} elName - 추가할 아이템 이름
338
341
  */
339
342
  addElement(event, elName) {
340
- if (!this._activeData) {
341
- console.error('[FreeDropEngine] 활성화된 데이터가 없습니다.');
342
- return;
343
- }
344
- if (this._activeData.mode !== 'free') return;
343
+ if (this._activeMode !== 'free') return;
345
344
 
346
345
  this._startPos = { x: event.clientX, y: event.clientY };
347
346
 
@@ -1,4 +1,4 @@
1
- import { cloneDeep, debounce } from 'lodash-es';
1
+ import { cloneDeep } from 'lodash-es';
2
2
 
3
3
  // event 발행 시 'gridDrop'으로 시작하는 이름 사용
4
4
  class GridDropEngine {
@@ -10,9 +10,10 @@ class GridDropEngine {
10
10
  this._elementsUpdate = false; // 원본 요소 목록 변경 플래그
11
11
  this._gridElements = []; // 로컬에서 사용하는 요소 목록
12
12
 
13
- this._layoutData = null;
14
- this._activeData = null;
13
+ // this._activeData = null;
15
14
  this._activeSection = null;
15
+ this._activeMode = null;
16
+ this._activeConfig = null;
16
17
  this._activeElement = null;
17
18
 
18
19
  this._targetCell = null; // 드래그 대상 셀
@@ -50,25 +51,15 @@ class GridDropEngine {
50
51
  this._initialize();
51
52
  });
52
53
 
53
- this._subscribe('system:enginesReset', () => {
54
- this._initialize();
55
- });
56
-
57
- // layoutData 변경 감지
58
- this._subscribe('system:updateLayoutData', ({ layoutData, activeData }) => {
59
- this._layoutData = layoutData;
60
- this._activeData = activeData;
61
- });
62
-
63
54
  // activeSection 변경 감지 (activeData가 함께 초기화됨)
64
- this._subscribe('system:updateActiveSection', ({ activeSection, activeData }) => {
65
- this._activeSection = activeSection;
66
- this._activeData = activeData;
67
- // this.setActiveElement(null);
55
+ this._subscribe('system:updateActiveSection', ({ $section, $mode, $config }) => {
56
+ this._activeSection = $section;
57
+ this._activeMode = $mode;
58
+ this._activeConfig = $config;
68
59
  });
69
60
 
70
- this._subscribe('system:setElements', ({ elements }) => {
71
- this._elements = elements;
61
+ this._subscribe('system:setElements', ({ $elements }) => {
62
+ this._elements = $elements;
72
63
  this._elementsUpdate = true;
73
64
 
74
65
  // 활성화 요소 초기화
@@ -80,22 +71,15 @@ class GridDropEngine {
80
71
  });
81
72
  });
82
73
 
83
- this._subscribe('system:updateActiveSectionConfig', ({ layoutData, activeData }) => {
84
- if (activeData?.mode == 'grid') {
85
- this._layoutData = layoutData;
86
- this._activeData = activeData;
87
- }
74
+ this._subscribe('layout:updateLayoutData', ({ $mode, $config }) => {
75
+ this._activeMode = $mode;
76
+ this._activeConfig = $config;
88
77
  });
89
78
 
90
- this._subscribe('system:requestUpdateData', ({ action, elements, elementId, layoutData, activeData }) => {
91
- this._elements = elements;
79
+ this._subscribe('system:requestUpdateElement', ({ action, $elements, $elementId }) => {
80
+ this._elements = $elements;
92
81
  this._elementsUpdate = true;
93
- this.setActiveElement(this._elements.find((x) => x.id === elementId) || null, action);
94
-
95
- if (activeData?.mode == 'grid') {
96
- this._layoutData = layoutData;
97
- this._activeData = activeData;
98
- }
82
+ this.setActiveElement(this._elements.find((x) => x.id === $elementId) || null, action);
99
83
 
100
84
  this.eventBus.emit('gridDrop:requestUpdateData', {
101
85
  elements: cloneDeep(this.gridElements),
@@ -119,13 +103,12 @@ class GridDropEngine {
119
103
  });
120
104
  });
121
105
 
122
- this._subscribe('system:requestUpdateElements', ({ elements }) => {
123
- this._elements = elements;
106
+ this._subscribe('system:requestElementsScale', ({ $elements }) => {
107
+ this._elements = $elements;
124
108
  this._elementsUpdate = true;
125
109
  });
126
110
 
127
111
  this._subscribe('system:restoredState', ({ stateData }) => {
128
- this._layoutData = stateData.layoutData;
129
112
  this._elements = stateData.elements;
130
113
  this._elementsUpdate = true;
131
114
  this.setActiveElement(null);
@@ -137,6 +120,12 @@ class GridDropEngine {
137
120
  });
138
121
  }
139
122
 
123
+ /** 엔진 초기화 */
124
+ reset() {
125
+ this._initialize();
126
+ console.log('[GridDropEngine] 리셋 완료');
127
+ }
128
+
140
129
  /** 삭제 및 정리 */
141
130
  destroy() {
142
131
  this._subscriptions.forEach((unsubscribe) => {
@@ -145,7 +134,7 @@ class GridDropEngine {
145
134
  }
146
135
  });
147
136
 
148
- this._initialize();
137
+ this.reset();
149
138
 
150
139
  this._subscriptions = [];
151
140
  this.eventBus = null;
@@ -203,8 +192,10 @@ class GridDropEngine {
203
192
  this._startPos = { x: 0, y: 0 };
204
193
  this._startSize = { w: 0, h: 0 };
205
194
 
206
- this._activeData = null;
195
+ // this._activeData = null;
207
196
  this._activeSection = null;
197
+ this._activeMode = null;
198
+ this._activeConfig = null;
208
199
  this._activeElement = null;
209
200
 
210
201
  this._elementsUpdate = false;
@@ -270,7 +261,7 @@ class GridDropEngine {
270
261
  * @returns {object} - 드래그된 셀 수 ({ dx: , dy: })
271
262
  */
272
263
  _calculateDrag(currentPos, cellSize) {
273
- const { gridGap } = this._activeData.config;
264
+ const { gridGap } = this._activeConfig;
274
265
 
275
266
  const dx = Math.round((currentPos.x - this._startPos.x) / (cellSize.w + gridGap));
276
267
  const dy = Math.round((currentPos.y - this._startPos.y) / (cellSize.h + gridGap));
@@ -283,7 +274,7 @@ class GridDropEngine {
283
274
  * @returns {number} - 그리드 셀 너비
284
275
  */
285
276
  _getGridCellWidth(element) {
286
- const { gridGap, gridColumns } = this._activeData.config;
277
+ const { gridGap, gridColumns } = this._activeConfig;
287
278
  const totalWidth = element.clientWidth - gridGap * (gridColumns - 1);
288
279
  return totalWidth / gridColumns;
289
280
  }
@@ -293,7 +284,7 @@ class GridDropEngine {
293
284
  * @returns {number} - 그리드 셀 높이
294
285
  */
295
286
  _getGridCellHeight(element) {
296
- const { gridGap, gridRows } = this._activeData.config;
287
+ const { gridGap, gridRows } = this._activeConfig;
297
288
  const totalHeight = element.clientHeight - gridGap * (gridRows - 1);
298
289
  return totalHeight / gridRows;
299
290
  }
@@ -331,11 +322,11 @@ class GridDropEngine {
331
322
  * @param {string} elName - 추가할 아이템 이름
332
323
  */
333
324
  addElement(elName) {
334
- if (!this._activeData || !this._dragState.activeCell) {
325
+ if (!this._dragState.activeCell) {
335
326
  console.error('[GridDropEngine] 활성화된 데이터가 없습니다.');
336
327
  return;
337
328
  }
338
- if (this._activeData.mode !== 'grid') return;
329
+ if (this._activeMode !== 'grid') return;
339
330
 
340
331
  const element = {
341
332
  id: elName + '_' + Date.now().toString(36) + Math.random().toString(36).slice(2, 7),
@@ -507,7 +498,7 @@ class GridDropEngine {
507
498
  // 리사이징 중인 경우에만 드래그 가능
508
499
  if (!this._dragState.isResizing) return;
509
500
 
510
- const { gridColumns, gridRows } = this._activeData.config;
501
+ const { gridColumns, gridRows } = this._activeConfig;
511
502
 
512
503
  const activeSection = document.querySelector('.section-active');
513
504
  const { dx, dy } = this._calculateDrag(