ninegrid2 6.751.0 → 6.752.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,47 +121169,45 @@ 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;
121176
121176
  if (!prev || !next || !parent) return;
121177
121177
 
121178
- // ⛓ splitter의 실제 크기 고정 기준 (최초 생성 기준)
121179
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121180
-
121181
- // 전체 부모 사이즈 측정
121182
- const parentSize = isHorizontal
121178
+ isHorizontal
121183
121179
  ? parent.getBoundingClientRect().width
121184
121180
  : parent.getBoundingClientRect().height;
121185
121181
 
121186
- // splitter 제외한 나머지 공간
121187
- const available = parentSize - splitterSize;
121188
-
121189
- // 현재 prev/next 실제 크기 기준으로 비율 역산
121182
+ // 현재 패널 크기 측정
121190
121183
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121191
121184
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121192
121185
  const totalPanelSize = prevSize + nextSize;
121193
121186
 
121194
- const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121195
- const nextRatio = 1 - prevRatio;
121187
+ // 현재 비율 계산
121188
+ ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121189
+ const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
121196
121190
 
121197
- // 비율 기반으로 pixel 크기 다시 계산
121198
- const newPrevSize = available * prevRatio;
121199
- const newNextSize = available * nextRatio;
121191
+ const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
121192
+ const newNextSize = totalPanelSize - newPrevSize;
121200
121193
 
121201
121194
  if (isHorizontal) {
121202
121195
  prev.style.width = `${newPrevSize}px`;
121203
- next.style.width = `${newNextSize}px`;
121204
- this.style.width = `${splitterSize}px`;
121196
+ //this.style.width = `${splitterSize}px`;
121197
+
121198
+ if (this.#isLastSplitter()) {
121199
+ next.style.width = `${newNextSize}px`;
121200
+ }
121205
121201
  } else {
121206
121202
  prev.style.height = `${newPrevSize}px`;
121207
- next.style.height = `${newNextSize}px`;
121208
- this.style.height = `${splitterSize}px`;
121203
+ //this.style.height = `${splitterSize}px`;
121204
+
121205
+ if (this.#isLastSplitter()) {
121206
+ next.style.height = `${newNextSize}px`;
121207
+ }
121209
121208
  }
121210
121209
  };
121211
121210
 
121212
-
121213
121211
  }
121214
121212
 
121215
121213
  customElements.define("nx-splitter", nxSplitter);
@@ -121165,47 +121165,45 @@ 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;
121172
121172
  if (!prev || !next || !parent) return;
121173
121173
 
121174
- // ⛓ splitter의 실제 크기 고정 기준 (최초 생성 기준)
121175
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121176
-
121177
- // 전체 부모 사이즈 측정
121178
- const parentSize = isHorizontal
121174
+ isHorizontal
121179
121175
  ? parent.getBoundingClientRect().width
121180
121176
  : parent.getBoundingClientRect().height;
121181
121177
 
121182
- // splitter 제외한 나머지 공간
121183
- const available = parentSize - splitterSize;
121184
-
121185
- // 현재 prev/next 실제 크기 기준으로 비율 역산
121178
+ // 현재 패널 크기 측정
121186
121179
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121187
121180
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121188
121181
  const totalPanelSize = prevSize + nextSize;
121189
121182
 
121190
- const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121191
- const nextRatio = 1 - prevRatio;
121183
+ // 현재 비율 계산
121184
+ ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121185
+ const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
121192
121186
 
121193
- // 비율 기반으로 pixel 크기 다시 계산
121194
- const newPrevSize = available * prevRatio;
121195
- const newNextSize = available * nextRatio;
121187
+ const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
121188
+ const newNextSize = totalPanelSize - newPrevSize;
121196
121189
 
121197
121190
  if (isHorizontal) {
121198
121191
  prev.style.width = `${newPrevSize}px`;
121199
- next.style.width = `${newNextSize}px`;
121200
- this.style.width = `${splitterSize}px`;
121192
+ //this.style.width = `${splitterSize}px`;
121193
+
121194
+ if (this.#isLastSplitter()) {
121195
+ next.style.width = `${newNextSize}px`;
121196
+ }
121201
121197
  } else {
121202
121198
  prev.style.height = `${newPrevSize}px`;
121203
- next.style.height = `${newNextSize}px`;
121204
- this.style.height = `${splitterSize}px`;
121199
+ //this.style.height = `${splitterSize}px`;
121200
+
121201
+ if (this.#isLastSplitter()) {
121202
+ next.style.height = `${newNextSize}px`;
121203
+ }
121205
121204
  }
121206
121205
  };
121207
121206
 
121208
-
121209
121207
  }
121210
121208
 
121211
121209
  customElements.define("nx-splitter", nxSplitter);
@@ -181,47 +181,49 @@ 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;
188
188
  if (!prev || !next || !parent) return;
189
189
 
190
- // ⛓ splitter의 실제 크기 고정 기준 (최초 생성 기준)
191
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
192
-
193
- // 전체 부모 사이즈 측정
194
190
  const parentSize = isHorizontal
195
191
  ? parent.getBoundingClientRect().width
196
192
  : parent.getBoundingClientRect().height;
197
193
 
198
- // splitter 제외한 나머지 공간
199
- const available = parentSize - splitterSize;
200
-
201
- // 현재 prev/next 실제 크기 기준으로 비율 역산
194
+ // 현재 패널 크기 측정
202
195
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
203
196
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
204
197
  const totalPanelSize = prevSize + nextSize;
205
198
 
206
- const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
199
+ // 현재 비율 계산
200
+ ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
201
+ const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
207
202
  const nextRatio = 1 - prevRatio;
208
203
 
209
- // 비율 기반으로 pixel 크기 다시 계산
210
- const newPrevSize = available * prevRatio;
211
- const newNextSize = available * nextRatio;
204
+ // 새로운 available 크기
205
+ const available = parentSize - splitterSize;
206
+
207
+ const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
208
+ const newNextSize = totalPanelSize - newPrevSize;
212
209
 
213
210
  if (isHorizontal) {
214
211
  prev.style.width = `${newPrevSize}px`;
215
- next.style.width = `${newNextSize}px`;
216
- this.style.width = `${splitterSize}px`;
212
+ //this.style.width = `${splitterSize}px`;
213
+
214
+ if (this.#isLastSplitter()) {
215
+ next.style.width = `${newNextSize}px`;
216
+ }
217
217
  } else {
218
218
  prev.style.height = `${newPrevSize}px`;
219
- next.style.height = `${newNextSize}px`;
220
- this.style.height = `${splitterSize}px`;
219
+ //this.style.height = `${splitterSize}px`;
220
+
221
+ if (this.#isLastSplitter()) {
222
+ next.style.height = `${newNextSize}px`;
223
+ }
221
224
  }
222
225
  };
223
226
 
224
-
225
227
  }
226
228
 
227
229
  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.751.0",
4
+ "version": "6.752.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -181,47 +181,49 @@ 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;
188
188
  if (!prev || !next || !parent) return;
189
189
 
190
- // ⛓ splitter의 실제 크기 고정 기준 (최초 생성 기준)
191
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
192
-
193
- // 전체 부모 사이즈 측정
194
190
  const parentSize = isHorizontal
195
191
  ? parent.getBoundingClientRect().width
196
192
  : parent.getBoundingClientRect().height;
197
193
 
198
- // splitter 제외한 나머지 공간
199
- const available = parentSize - splitterSize;
200
-
201
- // 현재 prev/next 실제 크기 기준으로 비율 역산
194
+ // 현재 패널 크기 측정
202
195
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
203
196
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
204
197
  const totalPanelSize = prevSize + nextSize;
205
198
 
206
- const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
199
+ // 현재 비율 계산
200
+ ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
201
+ const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
207
202
  const nextRatio = 1 - prevRatio;
208
203
 
209
- // 비율 기반으로 pixel 크기 다시 계산
210
- const newPrevSize = available * prevRatio;
211
- const newNextSize = available * nextRatio;
204
+ // 새로운 available 크기
205
+ const available = parentSize - splitterSize;
206
+
207
+ const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
208
+ const newNextSize = totalPanelSize - newPrevSize;
212
209
 
213
210
  if (isHorizontal) {
214
211
  prev.style.width = `${newPrevSize}px`;
215
- next.style.width = `${newNextSize}px`;
216
- this.style.width = `${splitterSize}px`;
212
+ //this.style.width = `${splitterSize}px`;
213
+
214
+ if (this.#isLastSplitter()) {
215
+ next.style.width = `${newNextSize}px`;
216
+ }
217
217
  } else {
218
218
  prev.style.height = `${newPrevSize}px`;
219
- next.style.height = `${newNextSize}px`;
220
- this.style.height = `${splitterSize}px`;
219
+ //this.style.height = `${splitterSize}px`;
220
+
221
+ if (this.#isLastSplitter()) {
222
+ next.style.height = `${newNextSize}px`;
223
+ }
221
224
  }
222
225
  };
223
226
 
224
-
225
227
  }
226
228
 
227
229
  customElements.define("nx-splitter", nxSplitter);