ninegrid2 6.742.0 → 6.745.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.
@@ -121168,10 +121168,9 @@ class nxSplitter extends HTMLElement {
121168
121168
  };
121169
121169
 
121170
121170
  #prepareLayout = () => {
121171
+ const isHorizontal = this.#mode === "h";
121171
121172
 
121172
-
121173
-
121174
- const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121173
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121175
121174
  const prev = this.previousElementSibling;
121176
121175
  const next = this.nextElementSibling;
121177
121176
  const parent = this.parentElement;
@@ -121179,27 +121178,27 @@ class nxSplitter extends HTMLElement {
121179
121178
  if (!prev || !next || !parent) return;
121180
121179
 
121181
121180
  const parentRect = parent.getBoundingClientRect();
121182
- const total = this.#mode === "h" ? parentRect.width : parentRect.height;
121183
- const available = total - splitterSize;
121184
- const eachSize = available / 2;
121181
+ const totalSize = isHorizontal ? parentRect.width : parentRect.height;
121185
121182
 
121186
- if (this.#mode === "h") {
121187
- prev.style.width = `${eachSize}px`;
121183
+ // splitter 자체 포함한 전체 영역에서 prev/next 비율 계산
121184
+ const splitterRatio = splitterSize / totalSize;
121185
+ const eachRatio = (1 - splitterRatio) / 2;
121186
+
121187
+ if (isHorizontal) {
121188
+ prev.style.width = `${eachRatio * 100}%`;
121188
121189
 
121189
- // ✔ 정확하게 마지막 splitter일 때만 next 조정
121190
121190
  if (this.#isLastSplitter()) {
121191
- next.style.width = `${eachSize}px`;
121192
- //next.style.width = "100%";
121191
+ next.style.width = `${eachRatio * 100}%`;
121193
121192
  }
121194
121193
  } else {
121195
- prev.style.height = `${eachSize}px`;
121194
+ prev.style.height = `${eachRatio * 100}%`;
121196
121195
 
121197
121196
  if (this.#isLastSplitter()) {
121198
- next.style.height = `${eachSize}px`;
121199
- //next.style.height = "100%";
121197
+ next.style.height = `${eachRatio * 100}%`;
121200
121198
  }
121201
121199
  }
121202
121200
  };
121201
+
121203
121202
  }
121204
121203
 
121205
121204
  customElements.define("nx-splitter", nxSplitter);
@@ -121164,10 +121164,9 @@ class nxSplitter extends HTMLElement {
121164
121164
  };
121165
121165
 
121166
121166
  #prepareLayout = () => {
121167
+ const isHorizontal = this.#mode === "h";
121167
121168
 
121168
-
121169
-
121170
- const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
121169
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121171
121170
  const prev = this.previousElementSibling;
121172
121171
  const next = this.nextElementSibling;
121173
121172
  const parent = this.parentElement;
@@ -121175,27 +121174,27 @@ class nxSplitter extends HTMLElement {
121175
121174
  if (!prev || !next || !parent) return;
121176
121175
 
121177
121176
  const parentRect = parent.getBoundingClientRect();
121178
- const total = this.#mode === "h" ? parentRect.width : parentRect.height;
121179
- const available = total - splitterSize;
121180
- const eachSize = available / 2;
121177
+ const totalSize = isHorizontal ? parentRect.width : parentRect.height;
121181
121178
 
121182
- if (this.#mode === "h") {
121183
- prev.style.width = `${eachSize}px`;
121179
+ // splitter 자체 포함한 전체 영역에서 prev/next 비율 계산
121180
+ const splitterRatio = splitterSize / totalSize;
121181
+ const eachRatio = (1 - splitterRatio) / 2;
121182
+
121183
+ if (isHorizontal) {
121184
+ prev.style.width = `${eachRatio * 100}%`;
121184
121185
 
121185
- // ✔ 정확하게 마지막 splitter일 때만 next 조정
121186
121186
  if (this.#isLastSplitter()) {
121187
- next.style.width = `${eachSize}px`;
121188
- //next.style.width = "100%";
121187
+ next.style.width = `${eachRatio * 100}%`;
121189
121188
  }
121190
121189
  } else {
121191
- prev.style.height = `${eachSize}px`;
121190
+ prev.style.height = `${eachRatio * 100}%`;
121192
121191
 
121193
121192
  if (this.#isLastSplitter()) {
121194
- next.style.height = `${eachSize}px`;
121195
- //next.style.height = "100%";
121193
+ next.style.height = `${eachRatio * 100}%`;
121196
121194
  }
121197
121195
  }
121198
121196
  };
121197
+
121199
121198
  }
121200
121199
 
121201
121200
  customElements.define("nx-splitter", nxSplitter);
@@ -180,10 +180,9 @@ class nxSplitter extends HTMLElement {
180
180
  };
181
181
 
182
182
  #prepareLayout = () => {
183
+ const isHorizontal = this.#mode === "h";
183
184
 
184
-
185
-
186
- const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
185
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
187
186
  const prev = this.previousElementSibling;
188
187
  const next = this.nextElementSibling;
189
188
  const parent = this.parentElement;
@@ -191,27 +190,27 @@ class nxSplitter extends HTMLElement {
191
190
  if (!prev || !next || !parent) return;
192
191
 
193
192
  const parentRect = parent.getBoundingClientRect();
194
- const total = this.#mode === "h" ? parentRect.width : parentRect.height;
195
- const available = total - splitterSize;
196
- const eachSize = available / 2;
193
+ const totalSize = isHorizontal ? parentRect.width : parentRect.height;
197
194
 
198
- if (this.#mode === "h") {
199
- prev.style.width = `${eachSize}px`;
195
+ // splitter 자체 포함한 전체 영역에서 prev/next 비율 계산
196
+ const splitterRatio = splitterSize / totalSize;
197
+ const eachRatio = (1 - splitterRatio) / 2;
198
+
199
+ if (isHorizontal) {
200
+ prev.style.width = `${eachRatio * 100}%`;
200
201
 
201
- // ✔ 정확하게 마지막 splitter일 때만 next 조정
202
202
  if (this.#isLastSplitter()) {
203
- next.style.width = `${eachSize}px`;
204
- //next.style.width = "100%";
203
+ next.style.width = `${eachRatio * 100}%`;
205
204
  }
206
205
  } else {
207
- prev.style.height = `${eachSize}px`;
206
+ prev.style.height = `${eachRatio * 100}%`;
208
207
 
209
208
  if (this.#isLastSplitter()) {
210
- next.style.height = `${eachSize}px`;
211
- //next.style.height = "100%";
209
+ next.style.height = `${eachRatio * 100}%`;
212
210
  }
213
211
  }
214
212
  };
213
+
215
214
  }
216
215
 
217
216
  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.742.0",
4
+ "version": "6.745.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -180,10 +180,9 @@ class nxSplitter extends HTMLElement {
180
180
  };
181
181
 
182
182
  #prepareLayout = () => {
183
+ const isHorizontal = this.#mode === "h";
183
184
 
184
-
185
-
186
- const splitterSize = this.#mode === "h" ? this.offsetWidth : this.offsetHeight;
185
+ const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
187
186
  const prev = this.previousElementSibling;
188
187
  const next = this.nextElementSibling;
189
188
  const parent = this.parentElement;
@@ -191,27 +190,27 @@ class nxSplitter extends HTMLElement {
191
190
  if (!prev || !next || !parent) return;
192
191
 
193
192
  const parentRect = parent.getBoundingClientRect();
194
- const total = this.#mode === "h" ? parentRect.width : parentRect.height;
195
- const available = total - splitterSize;
196
- const eachSize = available / 2;
193
+ const totalSize = isHorizontal ? parentRect.width : parentRect.height;
197
194
 
198
- if (this.#mode === "h") {
199
- prev.style.width = `${eachSize}px`;
195
+ // splitter 자체 포함한 전체 영역에서 prev/next 비율 계산
196
+ const splitterRatio = splitterSize / totalSize;
197
+ const eachRatio = (1 - splitterRatio) / 2;
198
+
199
+ if (isHorizontal) {
200
+ prev.style.width = `${eachRatio * 100}%`;
200
201
 
201
- // ✔ 정확하게 마지막 splitter일 때만 next 조정
202
202
  if (this.#isLastSplitter()) {
203
- next.style.width = `${eachSize}px`;
204
- //next.style.width = "100%";
203
+ next.style.width = `${eachRatio * 100}%`;
205
204
  }
206
205
  } else {
207
- prev.style.height = `${eachSize}px`;
206
+ prev.style.height = `${eachRatio * 100}%`;
208
207
 
209
208
  if (this.#isLastSplitter()) {
210
- next.style.height = `${eachSize}px`;
211
- //next.style.height = "100%";
209
+ next.style.height = `${eachRatio * 100}%`;
212
210
  }
213
211
  }
214
212
  };
213
+
215
214
  }
216
215
 
217
216
  customElements.define("nx-splitter", nxSplitter);