ninegrid2 6.749.0 → 6.751.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.
@@ -121175,37 +121175,41 @@ class nxSplitter extends HTMLElement {
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
+ // 전체 부모 사이즈 측정
121178
121182
  const parentSize = isHorizontal
121179
121183
  ? parent.getBoundingClientRect().width
121180
121184
  : parent.getBoundingClientRect().height;
121181
121185
 
121182
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121183
- const splitterRatio = splitterSize / parentSize;
121186
+ // splitter 제외한 나머지 공간
121187
+ const available = parentSize - splitterSize;
121184
121188
 
121185
- // 💡 prev/next 크기도 현재 기준으로 비율 계산
121189
+ // 현재 prev/next 실제 크기 기준으로 비율 역산
121186
121190
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121187
121191
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121188
- const panelSum = prevSize + nextSize;
121192
+ const totalPanelSize = prevSize + nextSize;
121189
121193
 
121190
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
121194
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121191
121195
  const nextRatio = 1 - prevRatio;
121192
121196
 
121193
- const availableRatio = 1 - splitterRatio;
121197
+ // 비율 기반으로 pixel 크기 다시 계산
121198
+ const newPrevSize = available * prevRatio;
121199
+ const newNextSize = available * nextRatio;
121194
121200
 
121195
- // 📌 비율 기반 스타일 적용
121196
121201
  if (isHorizontal) {
121197
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
121198
- next.style.width = `${availableRatio * nextRatio * 100}%`;
121199
- this.style.width = `${splitterRatio * 100}%`;
121202
+ prev.style.width = `${newPrevSize}px`;
121203
+ next.style.width = `${newNextSize}px`;
121204
+ this.style.width = `${splitterSize}px`;
121200
121205
  } else {
121201
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
121202
- next.style.height = `${availableRatio * nextRatio * 100}%`;
121203
- this.style.height = `${splitterRatio * 100}%`;
121206
+ prev.style.height = `${newPrevSize}px`;
121207
+ next.style.height = `${newNextSize}px`;
121208
+ this.style.height = `${splitterSize}px`;
121204
121209
  }
121205
121210
  };
121206
121211
 
121207
121212
 
121208
-
121209
121213
  }
121210
121214
 
121211
121215
  customElements.define("nx-splitter", nxSplitter);
@@ -121171,37 +121171,41 @@ class nxSplitter extends HTMLElement {
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
+ // 전체 부모 사이즈 측정
121174
121178
  const parentSize = isHorizontal
121175
121179
  ? parent.getBoundingClientRect().width
121176
121180
  : parent.getBoundingClientRect().height;
121177
121181
 
121178
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121179
- const splitterRatio = splitterSize / parentSize;
121182
+ // splitter 제외한 나머지 공간
121183
+ const available = parentSize - splitterSize;
121180
121184
 
121181
- // 💡 prev/next 크기도 현재 기준으로 비율 계산
121185
+ // 현재 prev/next 실제 크기 기준으로 비율 역산
121182
121186
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121183
121187
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121184
- const panelSum = prevSize + nextSize;
121188
+ const totalPanelSize = prevSize + nextSize;
121185
121189
 
121186
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
121190
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121187
121191
  const nextRatio = 1 - prevRatio;
121188
121192
 
121189
- const availableRatio = 1 - splitterRatio;
121193
+ // 비율 기반으로 pixel 크기 다시 계산
121194
+ const newPrevSize = available * prevRatio;
121195
+ const newNextSize = available * nextRatio;
121190
121196
 
121191
- // 📌 비율 기반 스타일 적용
121192
121197
  if (isHorizontal) {
121193
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
121194
- next.style.width = `${availableRatio * nextRatio * 100}%`;
121195
- this.style.width = `${splitterRatio * 100}%`;
121198
+ prev.style.width = `${newPrevSize}px`;
121199
+ next.style.width = `${newNextSize}px`;
121200
+ this.style.width = `${splitterSize}px`;
121196
121201
  } else {
121197
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
121198
- next.style.height = `${availableRatio * nextRatio * 100}%`;
121199
- this.style.height = `${splitterRatio * 100}%`;
121202
+ prev.style.height = `${newPrevSize}px`;
121203
+ next.style.height = `${newNextSize}px`;
121204
+ this.style.height = `${splitterSize}px`;
121200
121205
  }
121201
121206
  };
121202
121207
 
121203
121208
 
121204
-
121205
121209
  }
121206
121210
 
121207
121211
  customElements.define("nx-splitter", nxSplitter);
@@ -187,37 +187,41 @@ class nxSplitter extends HTMLElement {
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
+ // 전체 부모 사이즈 측정
190
194
  const parentSize = isHorizontal
191
195
  ? parent.getBoundingClientRect().width
192
196
  : parent.getBoundingClientRect().height;
193
197
 
194
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
195
- const splitterRatio = splitterSize / parentSize;
198
+ // splitter 제외한 나머지 공간
199
+ const available = parentSize - splitterSize;
196
200
 
197
- // 💡 prev/next 크기도 현재 기준으로 비율 계산
201
+ // 현재 prev/next 실제 크기 기준으로 비율 역산
198
202
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
199
203
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
200
- const panelSum = prevSize + nextSize;
204
+ const totalPanelSize = prevSize + nextSize;
201
205
 
202
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
206
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
203
207
  const nextRatio = 1 - prevRatio;
204
208
 
205
- const availableRatio = 1 - splitterRatio;
209
+ // 비율 기반으로 pixel 크기 다시 계산
210
+ const newPrevSize = available * prevRatio;
211
+ const newNextSize = available * nextRatio;
206
212
 
207
- // 📌 비율 기반 스타일 적용
208
213
  if (isHorizontal) {
209
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
210
- next.style.width = `${availableRatio * nextRatio * 100}%`;
211
- this.style.width = `${splitterRatio * 100}%`;
214
+ prev.style.width = `${newPrevSize}px`;
215
+ next.style.width = `${newNextSize}px`;
216
+ this.style.width = `${splitterSize}px`;
212
217
  } else {
213
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
214
- next.style.height = `${availableRatio * nextRatio * 100}%`;
215
- this.style.height = `${splitterRatio * 100}%`;
218
+ prev.style.height = `${newPrevSize}px`;
219
+ next.style.height = `${newNextSize}px`;
220
+ this.style.height = `${splitterSize}px`;
216
221
  }
217
222
  };
218
223
 
219
224
 
220
-
221
225
  }
222
226
 
223
227
  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.749.0",
4
+ "version": "6.751.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -187,37 +187,41 @@ class nxSplitter extends HTMLElement {
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
+ // 전체 부모 사이즈 측정
190
194
  const parentSize = isHorizontal
191
195
  ? parent.getBoundingClientRect().width
192
196
  : parent.getBoundingClientRect().height;
193
197
 
194
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
195
- const splitterRatio = splitterSize / parentSize;
198
+ // splitter 제외한 나머지 공간
199
+ const available = parentSize - splitterSize;
196
200
 
197
- // 💡 prev/next 크기도 현재 기준으로 비율 계산
201
+ // 현재 prev/next 실제 크기 기준으로 비율 역산
198
202
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
199
203
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
200
- const panelSum = prevSize + nextSize;
204
+ const totalPanelSize = prevSize + nextSize;
201
205
 
202
- const prevRatio = panelSum > 0 ? prevSize / panelSum : 0.5;
206
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
203
207
  const nextRatio = 1 - prevRatio;
204
208
 
205
- const availableRatio = 1 - splitterRatio;
209
+ // 비율 기반으로 pixel 크기 다시 계산
210
+ const newPrevSize = available * prevRatio;
211
+ const newNextSize = available * nextRatio;
206
212
 
207
- // 📌 비율 기반 스타일 적용
208
213
  if (isHorizontal) {
209
- prev.style.width = `${availableRatio * prevRatio * 100}%`;
210
- next.style.width = `${availableRatio * nextRatio * 100}%`;
211
- this.style.width = `${splitterRatio * 100}%`;
214
+ prev.style.width = `${newPrevSize}px`;
215
+ next.style.width = `${newNextSize}px`;
216
+ this.style.width = `${splitterSize}px`;
212
217
  } else {
213
- prev.style.height = `${availableRatio * prevRatio * 100}%`;
214
- next.style.height = `${availableRatio * nextRatio * 100}%`;
215
- this.style.height = `${splitterRatio * 100}%`;
218
+ prev.style.height = `${newPrevSize}px`;
219
+ next.style.height = `${newNextSize}px`;
220
+ this.style.height = `${splitterSize}px`;
216
221
  }
217
222
  };
218
223
 
219
224
 
220
-
221
225
  }
222
226
 
223
227
  customElements.define("nx-splitter", nxSplitter);