Skip to content

Commit 8a2b263

Browse files
committed
1.6.1
1 parent 56047a4 commit 8a2b263

6 files changed

Lines changed: 2 additions & 17 deletions

File tree

dist/index.esm.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ function hover(oe, opt) {
102102
}
103103

104104
function down(oe, opt) {
105-
const target = oe.target;
106105
const win = getWindow(oe);
107106
let { 'x': ox, 'y': oy } = getEventPos(oe);
108107
let isStart = false;
@@ -163,7 +162,6 @@ function down(oe, opt) {
163162
}
164163
};
165164
if (isPointer) {
166-
target?.setPointerCapture?.(oe.pointerId);
167165
win.addEventListener('pointermove', move, { 'passive': false });
168166
win.addEventListener('pointerup', end);
169167
win.addEventListener('pointercancel', end);
@@ -690,15 +688,13 @@ function scale(oe, handler) {
690688
}
691689
};
692690
down = (e) => {
693-
target.setPointerCapture?.(e.pointerId);
694691
state.pointers.set(e.pointerId, { 'x': e.clientX, 'y': e.clientY });
695692
if (state.pointers.size === 2) {
696693
const pts = Array.from(state.pointers.values());
697694
state.lastDis = Math.hypot(pts[0].x - pts[1].x, pts[0].y - pts[1].y);
698695
state.lastPos = { 'x': (pts[0].x + pts[1].x) / 2, 'y': (pts[0].y + pts[1].y) / 2 };
699696
}
700697
};
701-
target.setPointerCapture?.(oe.pointerId);
702698
win.addEventListener('pointermove', move, { 'passive': false });
703699
win.addEventListener('pointerup', up);
704700
win.addEventListener('pointercancel', up);

dist/index.umd.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
}
109109

110110
function down(oe, opt) {
111-
const target = oe.target;
112111
const win = getWindow(oe);
113112
let { 'x': ox, 'y': oy } = getEventPos(oe);
114113
let isStart = false;
@@ -169,7 +168,6 @@
169168
}
170169
};
171170
if (isPointer) {
172-
target?.setPointerCapture?.(oe.pointerId);
173171
win.addEventListener('pointermove', move, { 'passive': false });
174172
win.addEventListener('pointerup', end);
175173
win.addEventListener('pointercancel', end);
@@ -696,15 +694,13 @@
696694
}
697695
};
698696
down = (e) => {
699-
target.setPointerCapture?.(e.pointerId);
700697
state.pointers.set(e.pointerId, { 'x': e.clientX, 'y': e.clientY });
701698
if (state.pointers.size === 2) {
702699
const pts = Array.from(state.pointers.values());
703700
state.lastDis = Math.hypot(pts[0].x - pts[1].x, pts[0].y - pts[1].y);
704701
state.lastPos = { 'x': (pts[0].x + pts[1].x) / 2, 'y': (pts[0].y + pts[1].y) / 2 };
705702
}
706703
};
707-
target.setPointerCapture?.(oe.pointerId);
708704
win.addEventListener('pointermove', move, { 'passive': false });
709705
win.addEventListener('pointerup', up);
710706
win.addEventListener('pointercancel', up);

dist/index.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@litert/pointer",
3-
"version": "1.6.0",
3+
"version": "1.6.1",
44
"description": "A lightweight pointer event library for handling mouse, touch, and pen interactions in browsers.",
55
"type": "module",
66
"keywords": [

src/down.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import * as utils from './utils';
2222
* @param opt 回调选项
2323
*/
2424
export function down<T extends PointerEvent | MouseEvent>(oe: T, opt: types.IDownOptions<T>): void {
25-
/** --- 目标元素 --- */
26-
const target = oe.target as HTMLElement;
2725
const win = utils.getWindow(oe);
2826
let { 'x': ox, 'y': oy } = utils.getEventPos(oe);
2927
/** --- 是否已经触发过 start 事件 --- */
@@ -93,7 +91,6 @@ export function down<T extends PointerEvent | MouseEvent>(oe: T, opt: types.IDow
9391

9492
// --- 捕获指针以确保即使指针离开元素也能接收事件 ---
9593
if (isPointer) {
96-
target?.setPointerCapture?.(oe.pointerId);
9794
win.addEventListener('pointermove', move as EventListener, { 'passive': false });
9895
win.addEventListener('pointerup', end as EventListener);
9996
win.addEventListener('pointercancel', end as EventListener);

src/scale.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ export function scale(oe: PointerEvent | WheelEvent, handler: types.TScaleHandle
133133
};
134134

135135
down = (e: PointerEvent): void => {
136-
// --- 捕获新指针 ---
137-
target.setPointerCapture?.(e.pointerId);
138136
state.pointers.set(e.pointerId, { 'x': e.clientX, 'y': e.clientY });
139137
if (state.pointers.size === 2) {
140138
// --- 双指开始,计算初始距离和中心点 ---
@@ -144,8 +142,6 @@ export function scale(oe: PointerEvent | WheelEvent, handler: types.TScaleHandle
144142
}
145143
};
146144

147-
// --- 捕获当前指针 ---
148-
target.setPointerCapture?.(oe.pointerId);
149145
// --- 绑定事件 ---
150146
win.addEventListener('pointermove', move, { 'passive': false });
151147
win.addEventListener('pointerup', up);

0 commit comments

Comments
 (0)