lyb-pixi-js 1.10.4 → 1.10.6
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.
- package/Utils/LibPixiEvent.d.ts +2 -0
- package/Utils/LibPixiEvent.js +12 -1
- package/lyb-pixi.js +12 -1
- package/package.json +1 -1
package/Utils/LibPixiEvent.d.ts
CHANGED
package/Utils/LibPixiEvent.js
CHANGED
|
@@ -21,10 +21,21 @@ const debounceImmediate = (func, wait) => {
|
|
|
21
21
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiEvent-事件注册
|
|
22
22
|
*/
|
|
23
23
|
export const libPixiEvent = (v, eventName, callback, params = {}) => {
|
|
24
|
-
const { once = false, debounce = false, debounceTime = 1000 } = params;
|
|
24
|
+
const { once = false, debounce = false, debounceTime = 1000, preventDragClick = false } = params;
|
|
25
25
|
v.cursor = "pointer";
|
|
26
26
|
v.eventMode = "static";
|
|
27
|
+
let isDragging = false;
|
|
28
|
+
if (preventDragClick) {
|
|
29
|
+
v.on("pointerdown", () => {
|
|
30
|
+
isDragging = false;
|
|
31
|
+
});
|
|
32
|
+
v.on("pointermove", () => {
|
|
33
|
+
isDragging = true;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
27
36
|
const fn = (e) => {
|
|
37
|
+
if (isDragging && eventName === "pointertap")
|
|
38
|
+
return;
|
|
28
39
|
if (e.button === 2)
|
|
29
40
|
return;
|
|
30
41
|
callback(e);
|
package/lyb-pixi.js
CHANGED
|
@@ -48798,10 +48798,21 @@ void main(void)\r
|
|
|
48798
48798
|
};
|
|
48799
48799
|
};
|
|
48800
48800
|
const libPixiEvent = (v2, eventName, callback, params = {}) => {
|
|
48801
|
-
const { once = false, debounce = false, debounceTime = 1e3 } = params;
|
|
48801
|
+
const { once = false, debounce = false, debounceTime = 1e3, preventDragClick = false } = params;
|
|
48802
48802
|
v2.cursor = "pointer";
|
|
48803
48803
|
v2.eventMode = "static";
|
|
48804
|
+
let isDragging = false;
|
|
48805
|
+
if (preventDragClick) {
|
|
48806
|
+
v2.on("pointerdown", () => {
|
|
48807
|
+
isDragging = false;
|
|
48808
|
+
});
|
|
48809
|
+
v2.on("pointermove", () => {
|
|
48810
|
+
isDragging = true;
|
|
48811
|
+
});
|
|
48812
|
+
}
|
|
48804
48813
|
const fn = (e2) => {
|
|
48814
|
+
if (isDragging && eventName === "pointertap")
|
|
48815
|
+
return;
|
|
48805
48816
|
if (e2.button === 2)
|
|
48806
48817
|
return;
|
|
48807
48818
|
callback(e2);
|