ninegrid2 6.1064.0 → 6.1065.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.
@@ -121406,6 +121406,9 @@ class nxSplitter extends HTMLElement {
121406
121406
  const splitterRect = this.getBoundingClientRect();
121407
121407
  const isHorizontal = this.#mode === "h";
121408
121408
 
121409
+ // ⭐ 마우스 초기 위치 저장 ⭐
121410
+ const initialMousePos = isHorizontal ? e.clientX : e.clientY;
121411
+
121409
121412
  // 마우스 포인터와 스플리터 시작점 사이의 거리
121410
121413
  const clickOffset = isHorizontal
121411
121414
  ? e.clientX - splitterRect.left
@@ -121477,7 +121480,7 @@ class nxSplitter extends HTMLElement {
121477
121480
  console.log(clampedPos);
121478
121481
  };
121479
121482
 
121480
- const onUp = () => {
121483
+ const onUp = (e) => {
121481
121484
  window.removeEventListener("mousemove", onMove);
121482
121485
  window.removeEventListener("mouseup", onUp);
121483
121486
  dragBar.remove();
@@ -121506,8 +121509,12 @@ class nxSplitter extends HTMLElement {
121506
121509
 
121507
121510
 
121508
121511
  // 드래그로 인한 픽셀 변화량 계산
121509
- const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
121510
- (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
121512
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
121513
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
121514
+
121515
+ // ⭐ 정확한 dragOffset 계산 ⭐
121516
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
121517
+ const dragOffset = finalMousePos - initialMousePos;
121511
121518
 
121512
121519
  const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height - clickOffset;
121513
121520
  const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
@@ -121402,6 +121402,9 @@ class nxSplitter extends HTMLElement {
121402
121402
  const splitterRect = this.getBoundingClientRect();
121403
121403
  const isHorizontal = this.#mode === "h";
121404
121404
 
121405
+ // ⭐ 마우스 초기 위치 저장 ⭐
121406
+ const initialMousePos = isHorizontal ? e.clientX : e.clientY;
121407
+
121405
121408
  // 마우스 포인터와 스플리터 시작점 사이의 거리
121406
121409
  const clickOffset = isHorizontal
121407
121410
  ? e.clientX - splitterRect.left
@@ -121473,7 +121476,7 @@ class nxSplitter extends HTMLElement {
121473
121476
  console.log(clampedPos);
121474
121477
  };
121475
121478
 
121476
- const onUp = () => {
121479
+ const onUp = (e) => {
121477
121480
  window.removeEventListener("mousemove", onMove);
121478
121481
  window.removeEventListener("mouseup", onUp);
121479
121482
  dragBar.remove();
@@ -121502,8 +121505,12 @@ class nxSplitter extends HTMLElement {
121502
121505
 
121503
121506
 
121504
121507
  // 드래그로 인한 픽셀 변화량 계산
121505
- const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
121506
- (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
121508
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
121509
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
121510
+
121511
+ // ⭐ 정확한 dragOffset 계산 ⭐
121512
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
121513
+ const dragOffset = finalMousePos - initialMousePos;
121507
121514
 
121508
121515
  const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height - clickOffset;
121509
121516
  const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
@@ -39,6 +39,9 @@ class nxSplitter extends HTMLElement {
39
39
  const splitterRect = this.getBoundingClientRect();
40
40
  const isHorizontal = this.#mode === "h";
41
41
 
42
+ // ⭐ 마우스 초기 위치 저장 ⭐
43
+ const initialMousePos = isHorizontal ? e.clientX : e.clientY;
44
+
42
45
  // 마우스 포인터와 스플리터 시작점 사이의 거리
43
46
  const clickOffset = isHorizontal
44
47
  ? e.clientX - splitterRect.left
@@ -110,7 +113,7 @@ class nxSplitter extends HTMLElement {
110
113
  console.log(clampedPos);
111
114
  };
112
115
 
113
- const onUp = () => {
116
+ const onUp = (e) => {
114
117
  window.removeEventListener("mousemove", onMove);
115
118
  window.removeEventListener("mouseup", onUp);
116
119
  dragBar.remove();
@@ -139,8 +142,12 @@ class nxSplitter extends HTMLElement {
139
142
 
140
143
 
141
144
  // 드래그로 인한 픽셀 변화량 계산
142
- const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
143
- (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
145
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
146
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
147
+
148
+ // ⭐ 정확한 dragOffset 계산 ⭐
149
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
150
+ const dragOffset = finalMousePos - initialMousePos;
144
151
 
145
152
  const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height - clickOffset;
146
153
  const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1064.0",
4
+ "version": "6.1065.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -39,6 +39,9 @@ class nxSplitter extends HTMLElement {
39
39
  const splitterRect = this.getBoundingClientRect();
40
40
  const isHorizontal = this.#mode === "h";
41
41
 
42
+ // ⭐ 마우스 초기 위치 저장 ⭐
43
+ const initialMousePos = isHorizontal ? e.clientX : e.clientY;
44
+
42
45
  // 마우스 포인터와 스플리터 시작점 사이의 거리
43
46
  const clickOffset = isHorizontal
44
47
  ? e.clientX - splitterRect.left
@@ -110,7 +113,7 @@ class nxSplitter extends HTMLElement {
110
113
  console.log(clampedPos);
111
114
  };
112
115
 
113
- const onUp = () => {
116
+ const onUp = (e) => {
114
117
  window.removeEventListener("mousemove", onMove);
115
118
  window.removeEventListener("mouseup", onUp);
116
119
  dragBar.remove();
@@ -139,8 +142,12 @@ class nxSplitter extends HTMLElement {
139
142
 
140
143
 
141
144
  // 드래그로 인한 픽셀 변화량 계산
142
- const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
143
- (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
145
+ //const dragOffset = (isHorizontal ? parseFloat(dragBar.style.left) : parseFloat(dragBar.style.top)) -
146
+ // (isHorizontal ? this.getBoundingClientRect().left - parent.getBoundingClientRect().left : this.getBoundingClientRect().top - parent.getBoundingClientRect().top);
147
+
148
+ // ⭐ 정확한 dragOffset 계산 ⭐
149
+ const finalMousePos = isHorizontal ? e.clientX : e.clientY;
150
+ const dragOffset = finalMousePos - initialMousePos;
144
151
 
145
152
  const prevSize = isHorizontal ? prev.getBoundingClientRect().width : prev.getBoundingClientRect().height - clickOffset;
146
153
  const nextSize = isHorizontal ? next.getBoundingClientRect().width : next.getBoundingClientRect().height;