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.
@@ -6,6 +6,8 @@ export interface LibPixiEventParams {
6
6
  debounce?: boolean;
7
7
  /** 防抖时长 */
8
8
  debounceTime?: number;
9
+ /** 是否阻止拖动点击 */
10
+ preventDragClick?: boolean;
9
11
  }
10
12
  /** @description 事件注册
11
13
  * @param v 事件容器
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.10.4",
3
+ "version": "1.10.6",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {