ninegrid2 6.1068.0 → 6.1069.0

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.
@@ -121407,7 +121407,7 @@ class nxSplitter extends HTMLElement {
121407
121407
  const isHorizontal = this.#mode === "h";
121408
121408
 
121409
121409
  // ⭐ 마우스 초기 위치 저장 ⭐
121410
- isHorizontal ? e.clientX : e.clientY;
121410
+ const initialMousePos = isHorizontal ? e.clientX : e.clientY;
121411
121411
 
121412
121412
  // 마우스 포인터와 스플리터 시작점 사이의 거리
121413
121413
  isHorizontal
@@ -121488,19 +121488,10 @@ class nxSplitter extends HTMLElement {
121488
121488
  const allChildren = Array.from(parent.children);
121489
121489
  const allPanels = allChildren.filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
121490
121490
 
121491
- // ⭐⭐ 드래그 바의 최종 위치를 기준으로 dragOffset 계산 ⭐⭐
121492
- const finalDragBarPos = isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top);
121493
- const initialSplitterPos = isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top;
121494
- const dragOffset = finalDragBarPos - initialSplitterPos;
121495
-
121496
- const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
121497
- const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
121498
-
121499
- const newPrevSize = prevSize + dragOffset;
121500
- const newNextSize = nextSize - dragOffset;
121501
-
121502
- const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
121491
+ // ⭐⭐ 부모의 픽셀 크기 ⭐⭐
121492
+ const totalContainerSize = isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height;
121503
121493
 
121494
+ // ⭐⭐ 모든 스플리터의 총 픽셀 크기 ⭐⭐
121504
121495
  const totalSplitterSize = allChildren.reduce((sum, child) => {
121505
121496
  if (child.tagName.toLowerCase() === 'nx-splitter') {
121506
121497
  return sum + (isHorizontal ? child.getBoundingClientRect().width : child.getBoundingClientRect().height);
@@ -121508,8 +121499,32 @@ class nxSplitter extends HTMLElement {
121508
121499
  return sum;
121509
121500
  }, 0);
121510
121501
 
121511
- const totalContainerSize = (isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height);
121512
- const totalFlexSpace = totalContainerSize - totalSplitterSize;
121502
+ // ⭐⭐ Flexbox의 'gap' 크기 계산 (하드코딩된 8px 사용) ⭐⭐
121503
+ allChildren.length - 1;
121504
+ const totalGapSize = 0;//gapCount * 8;
121505
+
121506
+ // ⭐⭐ Flexbox 컨테이너의 '총 유효 공간' (패널들이 차지할 수 있는 공간) 계산 ⭐⭐
121507
+ const totalFlexSpace = totalContainerSize - totalSplitterSize - totalGapSize;
121508
+
121509
+ // ⭐⭐ 모든 패널의 초기 크기를 미리 저장 ⭐⭐
121510
+ const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
121511
+
121512
+
121513
+ // 드래그로 인한 픽셀 변화량 계산
121514
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
121515
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
121516
+
121517
+ // ⭐ 정확한 dragOffset 계산 ⭐
121518
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
121519
+ const dragOffset = finalMousePos - initialMousePos;
121520
+
121521
+ const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
121522
+ const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
121523
+
121524
+ const newPrevSize = prevSize + dragOffset;
121525
+ const newNextSize = nextSize - dragOffset;
121526
+
121527
+ console.log(prevSize, newPrevSize);
121513
121528
 
121514
121529
  let flexSum = 0;
121515
121530
  allPanels.forEach((panel, index) => {
@@ -121522,12 +121537,16 @@ class nxSplitter extends HTMLElement {
121522
121537
  newSize = initialSizes[index];
121523
121538
  }
121524
121539
 
121540
+ //console.log(newSize)
121541
+
121542
+ // ⭐⭐ 새로운 FlexBasis 계산 ⭐⭐
121525
121543
  const newFlexBasis = newSize / totalFlexSpace;
121526
121544
  panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
121527
121545
  flexSum += newFlexBasis;
121528
121546
  });
121529
121547
 
121530
- console.log(`dragOffset: ${dragOffset}`);
121548
+ // ⭐⭐ 계산된 합계를 로그로 출력하여 확인 ⭐⭐
121549
+ console.log(`newTotalFlexSpace: ${totalFlexSpace}`);
121531
121550
  console.log(`Calculated FlexSum: ${flexSum}`);
121532
121551
  };
121533
121552
 
@@ -121403,7 +121403,7 @@ class nxSplitter extends HTMLElement {
121403
121403
  const isHorizontal = this.#mode === "h";
121404
121404
 
121405
121405
  // ⭐ 마우스 초기 위치 저장 ⭐
121406
- isHorizontal ? e.clientX : e.clientY;
121406
+ const initialMousePos = isHorizontal ? e.clientX : e.clientY;
121407
121407
 
121408
121408
  // 마우스 포인터와 스플리터 시작점 사이의 거리
121409
121409
  isHorizontal
@@ -121484,19 +121484,10 @@ class nxSplitter extends HTMLElement {
121484
121484
  const allChildren = Array.from(parent.children);
121485
121485
  const allPanels = allChildren.filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
121486
121486
 
121487
- // ⭐⭐ 드래그 바의 최종 위치를 기준으로 dragOffset 계산 ⭐⭐
121488
- const finalDragBarPos = isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top);
121489
- const initialSplitterPos = isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top;
121490
- const dragOffset = finalDragBarPos - initialSplitterPos;
121491
-
121492
- const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
121493
- const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
121494
-
121495
- const newPrevSize = prevSize + dragOffset;
121496
- const newNextSize = nextSize - dragOffset;
121497
-
121498
- const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
121487
+ // ⭐⭐ 부모의 픽셀 크기 ⭐⭐
121488
+ const totalContainerSize = isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height;
121499
121489
 
121490
+ // ⭐⭐ 모든 스플리터의 총 픽셀 크기 ⭐⭐
121500
121491
  const totalSplitterSize = allChildren.reduce((sum, child) => {
121501
121492
  if (child.tagName.toLowerCase() === 'nx-splitter') {
121502
121493
  return sum + (isHorizontal ? child.getBoundingClientRect().width : child.getBoundingClientRect().height);
@@ -121504,8 +121495,32 @@ class nxSplitter extends HTMLElement {
121504
121495
  return sum;
121505
121496
  }, 0);
121506
121497
 
121507
- const totalContainerSize = (isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height);
121508
- const totalFlexSpace = totalContainerSize - totalSplitterSize;
121498
+ // ⭐⭐ Flexbox의 'gap' 크기 계산 (하드코딩된 8px 사용) ⭐⭐
121499
+ allChildren.length - 1;
121500
+ const totalGapSize = 0;//gapCount * 8;
121501
+
121502
+ // ⭐⭐ Flexbox 컨테이너의 '총 유효 공간' (패널들이 차지할 수 있는 공간) 계산 ⭐⭐
121503
+ const totalFlexSpace = totalContainerSize - totalSplitterSize - totalGapSize;
121504
+
121505
+ // ⭐⭐ 모든 패널의 초기 크기를 미리 저장 ⭐⭐
121506
+ const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
121507
+
121508
+
121509
+ // 드래그로 인한 픽셀 변화량 계산
121510
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
121511
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
121512
+
121513
+ // ⭐ 정확한 dragOffset 계산 ⭐
121514
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
121515
+ const dragOffset = finalMousePos - initialMousePos;
121516
+
121517
+ const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
121518
+ const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
121519
+
121520
+ const newPrevSize = prevSize + dragOffset;
121521
+ const newNextSize = nextSize - dragOffset;
121522
+
121523
+ console.log(prevSize, newPrevSize);
121509
121524
 
121510
121525
  let flexSum = 0;
121511
121526
  allPanels.forEach((panel, index) => {
@@ -121518,12 +121533,16 @@ class nxSplitter extends HTMLElement {
121518
121533
  newSize = initialSizes[index];
121519
121534
  }
121520
121535
 
121536
+ //console.log(newSize)
121537
+
121538
+ // ⭐⭐ 새로운 FlexBasis 계산 ⭐⭐
121521
121539
  const newFlexBasis = newSize / totalFlexSpace;
121522
121540
  panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
121523
121541
  flexSum += newFlexBasis;
121524
121542
  });
121525
121543
 
121526
- console.log(`dragOffset: ${dragOffset}`);
121544
+ // ⭐⭐ 계산된 합계를 로그로 출력하여 확인 ⭐⭐
121545
+ console.log(`newTotalFlexSpace: ${totalFlexSpace}`);
121527
121546
  console.log(`Calculated FlexSum: ${flexSum}`);
121528
121547
  };
121529
121548
 
@@ -121,19 +121,10 @@ class nxSplitter extends HTMLElement {
121
121
  const allChildren = Array.from(parent.children);
122
122
  const allPanels = allChildren.filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
123
123
 
124
- // ⭐⭐ 드래그 바의 최종 위치를 기준으로 dragOffset 계산 ⭐⭐
125
- const finalDragBarPos = isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top);
126
- const initialSplitterPos = isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top;
127
- const dragOffset = finalDragBarPos - initialSplitterPos;
128
-
129
- const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
130
- const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
131
-
132
- const newPrevSize = prevSize + dragOffset;
133
- const newNextSize = nextSize - dragOffset;
134
-
135
- const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
124
+ // ⭐⭐ 부모의 픽셀 크기 ⭐⭐
125
+ const totalContainerSize = isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height;
136
126
 
127
+ // ⭐⭐ 모든 스플리터의 총 픽셀 크기 ⭐⭐
137
128
  const totalSplitterSize = allChildren.reduce((sum, child) => {
138
129
  if (child.tagName.toLowerCase() === 'nx-splitter') {
139
130
  return sum + (isHorizontal ? child.getBoundingClientRect().width : child.getBoundingClientRect().height);
@@ -141,8 +132,32 @@ class nxSplitter extends HTMLElement {
141
132
  return sum;
142
133
  }, 0);
143
134
 
144
- const totalContainerSize = (isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height);
145
- const totalFlexSpace = totalContainerSize - totalSplitterSize;
135
+ // ⭐⭐ Flexbox의 'gap' 크기 계산 (하드코딩된 8px 사용) ⭐⭐
136
+ const gapCount = allChildren.length - 1;
137
+ const totalGapSize = 0;//gapCount * 8;
138
+
139
+ // ⭐⭐ Flexbox 컨테이너의 '총 유효 공간' (패널들이 차지할 수 있는 공간) 계산 ⭐⭐
140
+ const totalFlexSpace = totalContainerSize - totalSplitterSize - totalGapSize;
141
+
142
+ // ⭐⭐ 모든 패널의 초기 크기를 미리 저장 ⭐⭐
143
+ const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
144
+
145
+
146
+ // 드래그로 인한 픽셀 변화량 계산
147
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
148
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
149
+
150
+ // ⭐ 정확한 dragOffset 계산 ⭐
151
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
152
+ const dragOffset = finalMousePos - initialMousePos;
153
+
154
+ const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
155
+ const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
156
+
157
+ const newPrevSize = prevSize + dragOffset;
158
+ const newNextSize = nextSize - dragOffset;
159
+
160
+ console.log(prevSize, newPrevSize);
146
161
 
147
162
  let flexSum = 0;
148
163
  allPanels.forEach((panel, index) => {
@@ -155,12 +170,16 @@ class nxSplitter extends HTMLElement {
155
170
  newSize = initialSizes[index];
156
171
  }
157
172
 
173
+ //console.log(newSize)
174
+
175
+ // ⭐⭐ 새로운 FlexBasis 계산 ⭐⭐
158
176
  const newFlexBasis = newSize / totalFlexSpace;
159
177
  panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
160
178
  flexSum += newFlexBasis;
161
179
  });
162
180
 
163
- console.log(`dragOffset: ${dragOffset}`);
181
+ // ⭐⭐ 계산된 합계를 로그로 출력하여 확인 ⭐⭐
182
+ console.log(`newTotalFlexSpace: ${totalFlexSpace}`);
164
183
  console.log(`Calculated FlexSum: ${flexSum}`);
165
184
  };
166
185
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1068.0",
4
+ "version": "6.1069.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -121,19 +121,10 @@ class nxSplitter extends HTMLElement {
121
121
  const allChildren = Array.from(parent.children);
122
122
  const allPanels = allChildren.filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
123
123
 
124
- // ⭐⭐ 드래그 바의 최종 위치를 기준으로 dragOffset 계산 ⭐⭐
125
- const finalDragBarPos = isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top);
126
- const initialSplitterPos = isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top;
127
- const dragOffset = finalDragBarPos - initialSplitterPos;
128
-
129
- const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
130
- const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
131
-
132
- const newPrevSize = prevSize + dragOffset;
133
- const newNextSize = nextSize - dragOffset;
134
-
135
- const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
124
+ // ⭐⭐ 부모의 픽셀 크기 ⭐⭐
125
+ const totalContainerSize = isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height;
136
126
 
127
+ // ⭐⭐ 모든 스플리터의 총 픽셀 크기 ⭐⭐
137
128
  const totalSplitterSize = allChildren.reduce((sum, child) => {
138
129
  if (child.tagName.toLowerCase() === 'nx-splitter') {
139
130
  return sum + (isHorizontal ? child.getBoundingClientRect().width : child.getBoundingClientRect().height);
@@ -141,8 +132,32 @@ class nxSplitter extends HTMLElement {
141
132
  return sum;
142
133
  }, 0);
143
134
 
144
- const totalContainerSize = (isHorizontal ? parent.getBoundingClientRect().width : parent.getBoundingClientRect().height);
145
- const totalFlexSpace = totalContainerSize - totalSplitterSize;
135
+ // ⭐⭐ Flexbox의 'gap' 크기 계산 (하드코딩된 8px 사용) ⭐⭐
136
+ const gapCount = allChildren.length - 1;
137
+ const totalGapSize = 0;//gapCount * 8;
138
+
139
+ // ⭐⭐ Flexbox 컨테이너의 '총 유효 공간' (패널들이 차지할 수 있는 공간) 계산 ⭐⭐
140
+ const totalFlexSpace = totalContainerSize - totalSplitterSize - totalGapSize;
141
+
142
+ // ⭐⭐ 모든 패널의 초기 크기를 미리 저장 ⭐⭐
143
+ const initialSizes = allPanels.map(panel => isHorizontal ? panel.getBoundingClientRect().width : panel.getBoundingClientRect().height);
144
+
145
+
146
+ // 드래그로 인한 픽셀 변화량 계산
147
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
148
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
149
+
150
+ // ⭐ 정확한 dragOffset 계산 ⭐
151
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
152
+ const dragOffset = finalMousePos - initialMousePos;
153
+
154
+ const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height;
155
+ const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
156
+
157
+ const newPrevSize = prevSize + dragOffset;
158
+ const newNextSize = nextSize - dragOffset;
159
+
160
+ console.log(prevSize, newPrevSize);
146
161
 
147
162
  let flexSum = 0;
148
163
  allPanels.forEach((panel, index) => {
@@ -155,12 +170,16 @@ class nxSplitter extends HTMLElement {
155
170
  newSize = initialSizes[index];
156
171
  }
157
172
 
173
+ //console.log(newSize)
174
+
175
+ // ⭐⭐ 새로운 FlexBasis 계산 ⭐⭐
158
176
  const newFlexBasis = newSize / totalFlexSpace;
159
177
  panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
160
178
  flexSum += newFlexBasis;
161
179
  });
162
180
 
163
- console.log(`dragOffset: ${dragOffset}`);
181
+ // ⭐⭐ 계산된 합계를 로그로 출력하여 확인 ⭐⭐
182
+ console.log(`newTotalFlexSpace: ${totalFlexSpace}`);
164
183
  console.log(`Calculated FlexSum: ${flexSum}`);
165
184
  };
166
185