ninegrid2 6.1018.0 → 6.1020.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.
@@ -121470,6 +121470,7 @@ class nxSplitter extends HTMLElement {
121470
121470
  }
121471
121471
  };
121472
121472
 
121473
+ // #startDrag 메서드 내부 (수정된 onUp 함수)
121473
121474
  const onUp = () => {
121474
121475
  window.removeEventListener("mousemove", onMove);
121475
121476
  window.removeEventListener("mouseup", onUp);
@@ -121479,19 +121480,48 @@ class nxSplitter extends HTMLElement {
121479
121480
  ? parseFloat(dragBar.style.left)
121480
121481
  : parseFloat(dragBar.style.top);
121481
121482
 
121482
- const parentTotalSize = isHorizontal ? parentRect.width : parentRect.height;
121483
- const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
121483
+ const parent = this.parentElement;
121484
+ const parentRect = parent.getBoundingClientRect();
121485
+ const splitterRect = this.getBoundingClientRect();
121486
+ const prev = this.previousElementSibling;
121487
+ const next = this.nextElementSibling;
121488
+ const isHorizontal = this.#mode === "h";
121489
+
121490
+ const prevRect = prev.getBoundingClientRect();
121491
+ const nextRect = next.getBoundingClientRect();
121484
121492
 
121485
- const prevStartPosInParent = isHorizontal
121486
- ? prevRect.left - parentRect.left
121487
- : prevRect.top - parentRect.top;
121493
+ const prevStartPosInParent = isHorizontal ? prevRect.left - parentRect.left : prevRect.top - parentRect.top;
121494
+ const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
121488
121495
 
121496
+ // 새로 계산된 prev, next 패널의 픽셀 크기
121489
121497
  const newPrevSize = finalDragBarPosInParent - prevStartPosInParent;
121490
- const newNextSize = parentTotalSize - newPrevSize - splitterThickness;
121498
+ const newNextSize = (isHorizontal ? nextRect.right : nextRect.bottom) - finalDragBarPosInParent - splitterThickness;
121499
+
121500
+ const totalInitialSize = Array.from(parent.children)
121501
+ .filter(el => el.tagName.toLowerCase() !== 'nx-splitter')
121502
+ .reduce((sum, el) => {
121503
+ const size = isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
121504
+ return sum + size;
121505
+ }, 0);
121506
+
121507
+ const newTotalSize = totalInitialSize - (isHorizontal ? prevRect.width + nextRect.width : prevRect.height + nextRect.height) + newPrevSize + newNextSize;
121491
121508
 
121492
- // flex 속성 사용
121493
- prev.style.flex = `0 0 ${newPrevSize}px`;
121494
- next.style.flex = `0 0 ${newNextSize}px`;
121509
+ // 전체 패널의 새로운 Flex 비율을 계산하고 적용
121510
+ const allPanels = Array.from(parent.children).filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
121511
+
121512
+ allPanels.length;
121513
+
121514
+ allPanels.forEach(panel => {
121515
+ const panelRect = panel.getBoundingClientRect();
121516
+ const currentSize = isHorizontal ? panelRect.width : panelRect.height;
121517
+
121518
+ let newSize = currentSize;
121519
+ if (panel === prev) newSize = newPrevSize;
121520
+ if (panel === next) newSize = newNextSize;
121521
+
121522
+ const newFlexBasis = newSize / newTotalSize;
121523
+ panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
121524
+ });
121495
121525
  };
121496
121526
 
121497
121527
  window.addEventListener("mousemove", onMove);
@@ -121466,6 +121466,7 @@ class nxSplitter extends HTMLElement {
121466
121466
  }
121467
121467
  };
121468
121468
 
121469
+ // #startDrag 메서드 내부 (수정된 onUp 함수)
121469
121470
  const onUp = () => {
121470
121471
  window.removeEventListener("mousemove", onMove);
121471
121472
  window.removeEventListener("mouseup", onUp);
@@ -121475,19 +121476,48 @@ class nxSplitter extends HTMLElement {
121475
121476
  ? parseFloat(dragBar.style.left)
121476
121477
  : parseFloat(dragBar.style.top);
121477
121478
 
121478
- const parentTotalSize = isHorizontal ? parentRect.width : parentRect.height;
121479
- const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
121479
+ const parent = this.parentElement;
121480
+ const parentRect = parent.getBoundingClientRect();
121481
+ const splitterRect = this.getBoundingClientRect();
121482
+ const prev = this.previousElementSibling;
121483
+ const next = this.nextElementSibling;
121484
+ const isHorizontal = this.#mode === "h";
121485
+
121486
+ const prevRect = prev.getBoundingClientRect();
121487
+ const nextRect = next.getBoundingClientRect();
121480
121488
 
121481
- const prevStartPosInParent = isHorizontal
121482
- ? prevRect.left - parentRect.left
121483
- : prevRect.top - parentRect.top;
121489
+ const prevStartPosInParent = isHorizontal ? prevRect.left - parentRect.left : prevRect.top - parentRect.top;
121490
+ const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
121484
121491
 
121492
+ // 새로 계산된 prev, next 패널의 픽셀 크기
121485
121493
  const newPrevSize = finalDragBarPosInParent - prevStartPosInParent;
121486
- const newNextSize = parentTotalSize - newPrevSize - splitterThickness;
121494
+ const newNextSize = (isHorizontal ? nextRect.right : nextRect.bottom) - finalDragBarPosInParent - splitterThickness;
121495
+
121496
+ const totalInitialSize = Array.from(parent.children)
121497
+ .filter(el => el.tagName.toLowerCase() !== 'nx-splitter')
121498
+ .reduce((sum, el) => {
121499
+ const size = isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
121500
+ return sum + size;
121501
+ }, 0);
121502
+
121503
+ const newTotalSize = totalInitialSize - (isHorizontal ? prevRect.width + nextRect.width : prevRect.height + nextRect.height) + newPrevSize + newNextSize;
121487
121504
 
121488
- // flex 속성 사용
121489
- prev.style.flex = `0 0 ${newPrevSize}px`;
121490
- next.style.flex = `0 0 ${newNextSize}px`;
121505
+ // 전체 패널의 새로운 Flex 비율을 계산하고 적용
121506
+ const allPanels = Array.from(parent.children).filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
121507
+
121508
+ allPanels.length;
121509
+
121510
+ allPanels.forEach(panel => {
121511
+ const panelRect = panel.getBoundingClientRect();
121512
+ const currentSize = isHorizontal ? panelRect.width : panelRect.height;
121513
+
121514
+ let newSize = currentSize;
121515
+ if (panel === prev) newSize = newPrevSize;
121516
+ if (panel === next) newSize = newNextSize;
121517
+
121518
+ const newFlexBasis = newSize / newTotalSize;
121519
+ panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
121520
+ });
121491
121521
  };
121492
121522
 
121493
121523
  window.addEventListener("mousemove", onMove);
@@ -103,6 +103,7 @@ class nxSplitter extends HTMLElement {
103
103
  }
104
104
  };
105
105
 
106
+ // #startDrag 메서드 내부 (수정된 onUp 함수)
106
107
  const onUp = () => {
107
108
  window.removeEventListener("mousemove", onMove);
108
109
  window.removeEventListener("mouseup", onUp);
@@ -112,19 +113,48 @@ class nxSplitter extends HTMLElement {
112
113
  ? parseFloat(dragBar.style.left)
113
114
  : parseFloat(dragBar.style.top);
114
115
 
115
- const parentTotalSize = isHorizontal ? parentRect.width : parentRect.height;
116
- const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
116
+ const parent = this.parentElement;
117
+ const parentRect = parent.getBoundingClientRect();
118
+ const splitterRect = this.getBoundingClientRect();
119
+ const prev = this.previousElementSibling;
120
+ const next = this.nextElementSibling;
121
+ const isHorizontal = this.#mode === "h";
122
+
123
+ const prevRect = prev.getBoundingClientRect();
124
+ const nextRect = next.getBoundingClientRect();
117
125
 
118
- const prevStartPosInParent = isHorizontal
119
- ? prevRect.left - parentRect.left
120
- : prevRect.top - parentRect.top;
126
+ const prevStartPosInParent = isHorizontal ? prevRect.left - parentRect.left : prevRect.top - parentRect.top;
127
+ const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
121
128
 
129
+ // 새로 계산된 prev, next 패널의 픽셀 크기
122
130
  const newPrevSize = finalDragBarPosInParent - prevStartPosInParent;
123
- const newNextSize = parentTotalSize - newPrevSize - splitterThickness;
131
+ const newNextSize = (isHorizontal ? nextRect.right : nextRect.bottom) - finalDragBarPosInParent - splitterThickness;
132
+
133
+ const totalInitialSize = Array.from(parent.children)
134
+ .filter(el => el.tagName.toLowerCase() !== 'nx-splitter')
135
+ .reduce((sum, el) => {
136
+ const size = isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
137
+ return sum + size;
138
+ }, 0);
139
+
140
+ const newTotalSize = totalInitialSize - (isHorizontal ? prevRect.width + nextRect.width : prevRect.height + nextRect.height) + newPrevSize + newNextSize;
141
+
142
+ // 전체 패널의 새로운 Flex 비율을 계산하고 적용
143
+ const allPanels = Array.from(parent.children).filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
144
+
145
+ const newTotalFlex = allPanels.length;
146
+
147
+ allPanels.forEach(panel => {
148
+ const panelRect = panel.getBoundingClientRect();
149
+ const currentSize = isHorizontal ? panelRect.width : panelRect.height;
150
+
151
+ let newSize = currentSize;
152
+ if (panel === prev) newSize = newPrevSize;
153
+ if (panel === next) newSize = newNextSize;
124
154
 
125
- // flex 속성 사용
126
- prev.style.flex = `0 0 ${newPrevSize}px`;
127
- next.style.flex = `0 0 ${newNextSize}px`;
155
+ const newFlexBasis = newSize / newTotalSize;
156
+ panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
157
+ });
128
158
  };
129
159
 
130
160
  window.addEventListener("mousemove", onMove);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1018.0",
4
+ "version": "6.1020.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -103,6 +103,7 @@ class nxSplitter extends HTMLElement {
103
103
  }
104
104
  };
105
105
 
106
+ // #startDrag 메서드 내부 (수정된 onUp 함수)
106
107
  const onUp = () => {
107
108
  window.removeEventListener("mousemove", onMove);
108
109
  window.removeEventListener("mouseup", onUp);
@@ -112,19 +113,48 @@ class nxSplitter extends HTMLElement {
112
113
  ? parseFloat(dragBar.style.left)
113
114
  : parseFloat(dragBar.style.top);
114
115
 
115
- const parentTotalSize = isHorizontal ? parentRect.width : parentRect.height;
116
- const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
116
+ const parent = this.parentElement;
117
+ const parentRect = parent.getBoundingClientRect();
118
+ const splitterRect = this.getBoundingClientRect();
119
+ const prev = this.previousElementSibling;
120
+ const next = this.nextElementSibling;
121
+ const isHorizontal = this.#mode === "h";
122
+
123
+ const prevRect = prev.getBoundingClientRect();
124
+ const nextRect = next.getBoundingClientRect();
117
125
 
118
- const prevStartPosInParent = isHorizontal
119
- ? prevRect.left - parentRect.left
120
- : prevRect.top - parentRect.top;
126
+ const prevStartPosInParent = isHorizontal ? prevRect.left - parentRect.left : prevRect.top - parentRect.top;
127
+ const splitterThickness = isHorizontal ? splitterRect.width : splitterRect.height;
121
128
 
129
+ // 새로 계산된 prev, next 패널의 픽셀 크기
122
130
  const newPrevSize = finalDragBarPosInParent - prevStartPosInParent;
123
- const newNextSize = parentTotalSize - newPrevSize - splitterThickness;
131
+ const newNextSize = (isHorizontal ? nextRect.right : nextRect.bottom) - finalDragBarPosInParent - splitterThickness;
132
+
133
+ const totalInitialSize = Array.from(parent.children)
134
+ .filter(el => el.tagName.toLowerCase() !== 'nx-splitter')
135
+ .reduce((sum, el) => {
136
+ const size = isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
137
+ return sum + size;
138
+ }, 0);
139
+
140
+ const newTotalSize = totalInitialSize - (isHorizontal ? prevRect.width + nextRect.width : prevRect.height + nextRect.height) + newPrevSize + newNextSize;
141
+
142
+ // 전체 패널의 새로운 Flex 비율을 계산하고 적용
143
+ const allPanels = Array.from(parent.children).filter(el => el.tagName.toLowerCase() !== 'nx-splitter');
144
+
145
+ const newTotalFlex = allPanels.length;
146
+
147
+ allPanels.forEach(panel => {
148
+ const panelRect = panel.getBoundingClientRect();
149
+ const currentSize = isHorizontal ? panelRect.width : panelRect.height;
150
+
151
+ let newSize = currentSize;
152
+ if (panel === prev) newSize = newPrevSize;
153
+ if (panel === next) newSize = newNextSize;
124
154
 
125
- // flex 속성 사용
126
- prev.style.flex = `0 0 ${newPrevSize}px`;
127
- next.style.flex = `0 0 ${newNextSize}px`;
155
+ const newFlexBasis = newSize / newTotalSize;
156
+ panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
157
+ });
128
158
  };
129
159
 
130
160
  window.addEventListener("mousemove", onMove);