ninegrid2 6.748.0 → 6.750.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.
@@ -121169,7 +121169,7 @@ class nxSplitter extends HTMLElement {
121169
121169
 
121170
121170
  #prepareLayout = () => {
121171
121171
  const isHorizontal = this.#mode === "h";
121172
-
121172
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121173
121173
  const prev = this.previousElementSibling;
121174
121174
  const next = this.nextElementSibling;
121175
121175
  const parent = this.parentElement;
@@ -121179,33 +121179,38 @@ class nxSplitter extends HTMLElement {
121179
121179
  ? parent.getBoundingClientRect().width
121180
121180
  : parent.getBoundingClientRect().height;
121181
121181
 
121182
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121183
- const splitterRatio = splitterSize / parentSize;
121184
-
121185
- // 💡 prev/next 크기도 현재 값 기준으로 비율 계산
121182
+ // 현재 패널 크기 측정
121186
121183
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121187
121184
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121188
- const panelSum = prevSize + nextSize;
121185
+ const totalPanelSize = prevSize + nextSize;
121189
121186
 
121190
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
121187
+ // 현재 비율 계산
121188
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121191
121189
  const nextRatio = 1 - prevRatio;
121192
121190
 
121193
- const availableRatio = 1 - splitterRatio;
121191
+ // 새로운 available 크기
121192
+ const available = parentSize - splitterSize;
121193
+
121194
+ const newPrevSize = available * prevRatio;
121195
+ const newNextSize = available * nextRatio;
121194
121196
 
121195
- // 📌 비율 기반 스타일 적용
121196
121197
  if (isHorizontal) {
121197
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
121198
- next.style.width = `${availableRatio * nextRatio * 100}%`;
121199
- this.style.width = `${splitterRatio * 100}%`;
121198
+ prev.style.width = `${newPrevSize}px`;
121199
+ this.style.width = `${splitterSize}px`;
121200
+
121201
+ if (this.#isLastSplitter()) {
121202
+ next.style.width = `${newNextSize}px`;
121203
+ }
121200
121204
  } else {
121201
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
121202
- next.style.height = `${availableRatio * nextRatio * 100}%`;
121203
- this.style.height = `${splitterRatio * 100}%`;
121205
+ prev.style.height = `${newPrevSize}px`;
121206
+ this.style.height = `${splitterSize}px`;
121207
+
121208
+ if (this.#isLastSplitter()) {
121209
+ next.style.height = `${newNextSize}px`;
121210
+ }
121204
121211
  }
121205
121212
  };
121206
121213
 
121207
-
121208
-
121209
121214
  }
121210
121215
 
121211
121216
  customElements.define("nx-splitter", nxSplitter);
@@ -121165,7 +121165,7 @@ class nxSplitter extends HTMLElement {
121165
121165
 
121166
121166
  #prepareLayout = () => {
121167
121167
  const isHorizontal = this.#mode === "h";
121168
-
121168
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121169
121169
  const prev = this.previousElementSibling;
121170
121170
  const next = this.nextElementSibling;
121171
121171
  const parent = this.parentElement;
@@ -121175,33 +121175,38 @@ class nxSplitter extends HTMLElement {
121175
121175
  ? parent.getBoundingClientRect().width
121176
121176
  : parent.getBoundingClientRect().height;
121177
121177
 
121178
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121179
- const splitterRatio = splitterSize / parentSize;
121180
-
121181
- // 💡 prev/next 크기도 현재 값 기준으로 비율 계산
121178
+ // 현재 패널 크기 측정
121182
121179
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121183
121180
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121184
- const panelSum = prevSize + nextSize;
121181
+ const totalPanelSize = prevSize + nextSize;
121185
121182
 
121186
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
121183
+ // 현재 비율 계산
121184
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121187
121185
  const nextRatio = 1 - prevRatio;
121188
121186
 
121189
- const availableRatio = 1 - splitterRatio;
121187
+ // 새로운 available 크기
121188
+ const available = parentSize - splitterSize;
121189
+
121190
+ const newPrevSize = available * prevRatio;
121191
+ const newNextSize = available * nextRatio;
121190
121192
 
121191
- // 📌 비율 기반 스타일 적용
121192
121193
  if (isHorizontal) {
121193
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
121194
- next.style.width = `${availableRatio * nextRatio * 100}%`;
121195
- this.style.width = `${splitterRatio * 100}%`;
121194
+ prev.style.width = `${newPrevSize}px`;
121195
+ this.style.width = `${splitterSize}px`;
121196
+
121197
+ if (this.#isLastSplitter()) {
121198
+ next.style.width = `${newNextSize}px`;
121199
+ }
121196
121200
  } else {
121197
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
121198
- next.style.height = `${availableRatio * nextRatio * 100}%`;
121199
- this.style.height = `${splitterRatio * 100}%`;
121201
+ prev.style.height = `${newPrevSize}px`;
121202
+ this.style.height = `${splitterSize}px`;
121203
+
121204
+ if (this.#isLastSplitter()) {
121205
+ next.style.height = `${newNextSize}px`;
121206
+ }
121200
121207
  }
121201
121208
  };
121202
121209
 
121203
-
121204
-
121205
121210
  }
121206
121211
 
121207
121212
  customElements.define("nx-splitter", nxSplitter);
@@ -181,7 +181,7 @@ class nxSplitter extends HTMLElement {
181
181
 
182
182
  #prepareLayout = () => {
183
183
  const isHorizontal = this.#mode === "h";
184
-
184
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
185
185
  const prev = this.previousElementSibling;
186
186
  const next = this.nextElementSibling;
187
187
  const parent = this.parentElement;
@@ -191,33 +191,38 @@ class nxSplitter extends HTMLElement {
191
191
  ? parent.getBoundingClientRect().width
192
192
  : parent.getBoundingClientRect().height;
193
193
 
194
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
195
- const splitterRatio = splitterSize / parentSize;
196
-
197
- // 💡 prev/next 크기도 현재 값 기준으로 비율 계산
194
+ // 현재 패널 크기 측정
198
195
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
199
196
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
200
- const panelSum = prevSize + nextSize;
197
+ const totalPanelSize = prevSize + nextSize;
201
198
 
202
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
199
+ // 현재 비율 계산
200
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
203
201
  const nextRatio = 1 - prevRatio;
204
202
 
205
- const availableRatio = 1 - splitterRatio;
203
+ // 새로운 available 크기
204
+ const available = parentSize - splitterSize;
205
+
206
+ const newPrevSize = available * prevRatio;
207
+ const newNextSize = available * nextRatio;
206
208
 
207
- // 📌 비율 기반 스타일 적용
208
209
  if (isHorizontal) {
209
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
210
- next.style.width = `${availableRatio * nextRatio * 100}%`;
211
- this.style.width = `${splitterRatio * 100}%`;
210
+ prev.style.width = `${newPrevSize}px`;
211
+ this.style.width = `${splitterSize}px`;
212
+
213
+ if (this.#isLastSplitter()) {
214
+ next.style.width = `${newNextSize}px`;
215
+ }
212
216
  } else {
213
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
214
- next.style.height = `${availableRatio * nextRatio * 100}%`;
215
- this.style.height = `${splitterRatio * 100}%`;
217
+ prev.style.height = `${newPrevSize}px`;
218
+ this.style.height = `${splitterSize}px`;
219
+
220
+ if (this.#isLastSplitter()) {
221
+ next.style.height = `${newNextSize}px`;
222
+ }
216
223
  }
217
224
  };
218
225
 
219
-
220
-
221
226
  }
222
227
 
223
228
  customElements.define("nx-splitter", nxSplitter);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.748.0",
4
+ "version": "6.750.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -181,7 +181,7 @@ class nxSplitter extends HTMLElement {
181
181
 
182
182
  #prepareLayout = () => {
183
183
  const isHorizontal = this.#mode === "h";
184
-
184
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
185
185
  const prev = this.previousElementSibling;
186
186
  const next = this.nextElementSibling;
187
187
  const parent = this.parentElement;
@@ -191,33 +191,38 @@ class nxSplitter extends HTMLElement {
191
191
  ? parent.getBoundingClientRect().width
192
192
  : parent.getBoundingClientRect().height;
193
193
 
194
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
195
- const splitterRatio = splitterSize / parentSize;
196
-
197
- // 💡 prev/next 크기도 현재 값 기준으로 비율 계산
194
+ // 현재 패널 크기 측정
198
195
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
199
196
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
200
- const panelSum = prevSize + nextSize;
197
+ const totalPanelSize = prevSize + nextSize;
201
198
 
202
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
199
+ // 현재 비율 계산
200
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
203
201
  const nextRatio = 1 - prevRatio;
204
202
 
205
- const availableRatio = 1 - splitterRatio;
203
+ // 새로운 available 크기
204
+ const available = parentSize - splitterSize;
205
+
206
+ const newPrevSize = available * prevRatio;
207
+ const newNextSize = available * nextRatio;
206
208
 
207
- // 📌 비율 기반 스타일 적용
208
209
  if (isHorizontal) {
209
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
210
- next.style.width = `${availableRatio * nextRatio * 100}%`;
211
- this.style.width = `${splitterRatio * 100}%`;
210
+ prev.style.width = `${newPrevSize}px`;
211
+ this.style.width = `${splitterSize}px`;
212
+
213
+ if (this.#isLastSplitter()) {
214
+ next.style.width = `${newNextSize}px`;
215
+ }
212
216
  } else {
213
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
214
- next.style.height = `${availableRatio * nextRatio * 100}%`;
215
- this.style.height = `${splitterRatio * 100}%`;
217
+ prev.style.height = `${newPrevSize}px`;
218
+ this.style.height = `${splitterSize}px`;
219
+
220
+ if (this.#isLastSplitter()) {
221
+ next.style.height = `${newNextSize}px`;
222
+ }
216
223
  }
217
224
  };
218
225
 
219
-
220
-
221
226
  }
222
227
 
223
228
  customElements.define("nx-splitter", nxSplitter);