lyb-pixi-js 1.11.10 → 1.11.12

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.
@@ -0,0 +1,36 @@
1
+ import { Container } from "pixi.js";
2
+ /** @description 拖拽定位 */
3
+ export declare class LibDragLocate extends Container {
4
+ static stage: Container;
5
+ /** 输入框 */
6
+ private _inputEl;
7
+ /** 搜索结果 */
8
+ private _resultEl;
9
+ /** 状态栏元素 */
10
+ private _statusBarEl;
11
+ /** 坐标元素 */
12
+ private _positionEl;
13
+ /** 当前坐标值 */
14
+ private _positionValue;
15
+ /** 是否处于定位状态 */
16
+ private _isLocalte;
17
+ /** 是否显示输入框 */
18
+ private _showInput;
19
+ /** 是否允许移动 */
20
+ private _allowMove;
21
+ /** 按下坐标 */
22
+ private _downPos;
23
+ /** 当前处于移动的元素 */
24
+ private _currentMoveContainer?;
25
+ constructor();
26
+ /** @description 创建输入框 */
27
+ private _createInput;
28
+ /** @description 创建用于展示搜索结果的列表 */
29
+ private _createResultList;
30
+ /** @description 创建搜索结果元素 */
31
+ private _createResultEl;
32
+ /** @description 创建状态栏 */
33
+ private _createStatusBar;
34
+ /** @description 递归搜索 */
35
+ private _findByName;
36
+ }
@@ -0,0 +1,230 @@
1
+ import { Container, Ticker } from "pixi.js";
2
+ import gsap from "gsap";
3
+ import { libPixiFilter } from "../../Utils/LibPixiFilter";
4
+ import { libJsCopy } from "lyb-js/Browser/LibJsCopy.js";
5
+ /** @description 拖拽定位 */
6
+ export class LibDragLocate extends Container {
7
+ constructor() {
8
+ super();
9
+ /** 当前坐标值 */
10
+ this._positionValue = "";
11
+ /** 是否处于定位状态 */
12
+ this._isLocalte = false;
13
+ /** 是否显示输入框 */
14
+ this._showInput = false;
15
+ /** 是否允许移动 */
16
+ this._allowMove = false;
17
+ /** 按下坐标 */
18
+ this._downPos = { x: 0, y: 0 };
19
+ window.addEventListener("keydown", (e) => {
20
+ if (e.altKey && e.key.toLowerCase() === "q") {
21
+ if (this._isLocalte)
22
+ return;
23
+ this._showInput = true;
24
+ e.preventDefault();
25
+ }
26
+ if (e.key === "Escape") {
27
+ this._showInput = false;
28
+ }
29
+ });
30
+ this._createInput();
31
+ this._createResultList();
32
+ this._createStatusBar();
33
+ LibDragLocate.stage.on("pointerdown", (event) => {
34
+ if (!this._currentMoveContainer)
35
+ return;
36
+ this._allowMove = true;
37
+ const { x, y } = LibDragLocate.stage.toLocal(event.global);
38
+ this._downPos = { x, y };
39
+ });
40
+ LibDragLocate.stage.on("pointermove", (event) => {
41
+ if (!this._allowMove || !this._currentMoveContainer)
42
+ return;
43
+ const { x, y } = LibDragLocate.stage.toLocal(event.global);
44
+ const dx = x - this._downPos.x;
45
+ const dy = y - this._downPos.y;
46
+ this._currentMoveContainer.x += dx;
47
+ this._currentMoveContainer.y += dy;
48
+ this._downPos = { x, y };
49
+ const posX = Math.round(this._currentMoveContainer.x);
50
+ const posY = Math.round(this._currentMoveContainer.y);
51
+ this._positionEl.textContent = `X: ${posX}, Y: ${posY}`;
52
+ this._positionValue = `xxx.position.set(${posX}, ${posY})`;
53
+ });
54
+ LibDragLocate.stage.on("pointerup", () => {
55
+ this._allowMove = false;
56
+ }, this);
57
+ Ticker.shared.add(() => {
58
+ if (this._showInput) {
59
+ if (this._isLocalte) {
60
+ this._inputEl.style.display = "none";
61
+ this._resultEl.style.display = "none";
62
+ this._statusBarEl.style.display = "flex";
63
+ }
64
+ else {
65
+ this._inputEl.style.display = "block";
66
+ this._resultEl.style.display = "flex";
67
+ this._statusBarEl.style.display = "none";
68
+ this._inputEl.focus();
69
+ }
70
+ }
71
+ else {
72
+ this._inputEl.style.display = "none";
73
+ this._resultEl.style.display = "none";
74
+ }
75
+ });
76
+ }
77
+ /** @description 创建输入框 */
78
+ _createInput() {
79
+ this._inputEl = document.createElement("input");
80
+ this._inputEl.type = "text";
81
+ this._inputEl.style.cssText = `
82
+ background-color: rgba(0,0,0,0.75);
83
+ border: 2px solid rgba(255,255,255,0.5);
84
+ color: #fff;
85
+ display: none;
86
+ font-size: 25px;
87
+ height: 50px;
88
+ left: 50%;
89
+ outline: none;
90
+ position: fixed;
91
+ text-align: center;
92
+ top: 25%;
93
+ transform: translate(-50%, -50%);
94
+ width: 50vw;
95
+ `;
96
+ document.body.appendChild(this._inputEl);
97
+ this._inputEl.addEventListener("input", () => {
98
+ const results = this._findByName(LibDragLocate.stage, this._inputEl.value);
99
+ //创建搜索结果列表
100
+ this._resultEl.innerHTML = "";
101
+ const renderNode = (item) => {
102
+ const resultEl = this._createResultEl(item.node.constructor.name, item.node.name, item.depth);
103
+ this._resultEl.appendChild(resultEl);
104
+ gsap.killTweensOf(item.node);
105
+ //悬浮结果列表元素闪烁
106
+ resultEl.addEventListener("mouseenter", () => {
107
+ gsap.to(item.node, {
108
+ alpha: 0,
109
+ duration: 0.25,
110
+ yoyo: true,
111
+ ease: "none",
112
+ repeat: -1,
113
+ });
114
+ });
115
+ //离开结果后停止闪烁
116
+ resultEl.addEventListener("mouseleave", () => {
117
+ gsap.killTweensOf(item.node);
118
+ item.node.alpha = 1;
119
+ });
120
+ resultEl.addEventListener("click", () => {
121
+ gsap.killTweensOf(item.node);
122
+ this._currentMoveContainer = item.node;
123
+ item.node.alpha = 1;
124
+ item.node.filters = [libPixiFilter("desaturate", 0)];
125
+ this._isLocalte = true;
126
+ });
127
+ item.children.forEach(renderNode);
128
+ };
129
+ results.forEach(renderNode);
130
+ });
131
+ }
132
+ /** @description 创建用于展示搜索结果的列表 */
133
+ _createResultList() {
134
+ this._resultEl = document.createElement("div");
135
+ this._resultEl.style.cssText = `
136
+ background-color: rgba(0,0,0,0.75);
137
+ border: 2px solid rgba(255,255,255,0.5);
138
+ left: 50%;
139
+ transform: translateX(-50%);
140
+ height: 300px;
141
+ overflow-y: auto;
142
+ position: fixed;
143
+ display: none;
144
+ gap: 10px;
145
+ flex-direction: column;
146
+ top: calc(25% + 50px);
147
+ width: 50vw;
148
+ `;
149
+ document.body.appendChild(this._resultEl);
150
+ }
151
+ /** @description 创建搜索结果元素 */
152
+ _createResultEl(className, tagName, depth) {
153
+ const resultItem = document.createElement("div");
154
+ resultItem.style.cssText = `
155
+ display: flex;
156
+ justify-content: space-between;
157
+ padding: 5px 10px;
158
+ align-items: center;
159
+ width: 100%;
160
+ font-size: 25px;
161
+ background-color: rgba(255,255,255,0.1);
162
+ color: #fff;
163
+ padding-left: ${depth * 20}px;
164
+ `;
165
+ const classNameEl = document.createElement("div");
166
+ classNameEl.textContent = className;
167
+ resultItem.appendChild(classNameEl);
168
+ const tagNameEl = document.createElement("div");
169
+ tagNameEl.textContent = tagName;
170
+ resultItem.appendChild(tagNameEl);
171
+ return resultItem;
172
+ }
173
+ /** @description 创建状态栏 */
174
+ _createStatusBar() {
175
+ this._statusBarEl = document.createElement("div");
176
+ this._statusBarEl.style.cssText = `
177
+ align-items: center;
178
+ background-color: rgba(0,0,0,0.75);
179
+ border: 2px solid rgba(0, 255, 13, 0.5);
180
+ color: #fff;
181
+ display: none;
182
+ font-size: 25px;
183
+ justify-content: center;
184
+ position: fixed;
185
+ top: 25%;
186
+ height: 50px;
187
+ left: 50%;
188
+ transform: translate(-50%, -50%);
189
+ width: 50vw;
190
+ `;
191
+ this._positionEl = document.createElement("div");
192
+ this._statusBarEl.appendChild(this._positionEl);
193
+ document.body.appendChild(this._statusBarEl);
194
+ this._statusBarEl.addEventListener("click", () => {
195
+ this._isLocalte = false;
196
+ libJsCopy(this._positionValue);
197
+ if (this._currentMoveContainer) {
198
+ this._currentMoveContainer.filters = [];
199
+ this._currentMoveContainer = undefined;
200
+ }
201
+ });
202
+ }
203
+ /** @description 递归搜索 */
204
+ _findByName(root, keyword) {
205
+ if (!keyword)
206
+ return [];
207
+ const match = (node) => {
208
+ var _a;
209
+ return ((_a = node.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(keyword.toLowerCase())) ||
210
+ node.constructor.name.toLowerCase().includes(keyword.toLowerCase());
211
+ };
212
+ const dfs = (node, depth) => {
213
+ const children = node.children
214
+ .filter((c) => c instanceof Container)
215
+ .flatMap((c) => dfs(c, depth + 1));
216
+ if (match(node) || children.length > 0) {
217
+ return [
218
+ {
219
+ node,
220
+ depth,
221
+ children,
222
+ expanded: true,
223
+ },
224
+ ];
225
+ }
226
+ return [];
227
+ };
228
+ return dfs(root, 0);
229
+ }
230
+ }
@@ -18,7 +18,7 @@ export class LibPixiPuzzleBg extends Container {
18
18
  bg.position.set(x || 0, y || 0);
19
19
  //监听鼠标空格事件
20
20
  document.addEventListener("keydown", (e) => {
21
- if (e.code === "Space") {
21
+ if (e.altKey && e.code === "Space") {
22
22
  bg.visible = !bg.visible;
23
23
  }
24
24
  else if (e.code === "ArrowUp") {
package/libPixiJs.d.ts CHANGED
@@ -27,6 +27,7 @@ import { LibPixiSlide } from "./Components/Custom/LibPixiSlide";
27
27
  import { LibPixiLabelValue } from "./Components/Custom/LibPixiLabelValue";
28
28
  import { LibPixiPuzzleBg } from "./Components/Custom/LibPixiPuzzleBg";
29
29
  import { LibDestroyContainer } from "./Components/Base/LibDestroyContainer";
30
+ import { LibDragLocate } from "./Components/Custom/LibDragLocate";
30
31
  /** @description 组件 */
31
32
  export declare const Components: {
32
33
  Base: {
@@ -126,10 +127,10 @@ export declare const Components: {
126
127
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
127
128
  */
128
129
  LibPixiLabelValue: typeof LibPixiLabelValue;
129
- /** @description 设计图背景拼接
130
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
131
- */
130
+ /** @description 设计图背景拼接 */
132
131
  LibPixiPuzzleBg: typeof LibPixiPuzzleBg;
132
+ /** @description 元素拖拽定位 */
133
+ LibDragLocate: typeof LibDragLocate;
133
134
  };
134
135
  };
135
136
  /** @description 方法 */
package/libPixiJs.js CHANGED
@@ -45,6 +45,7 @@ import { libContainerCenter } from "./Utils/LibContainerCenter";
45
45
  import { libPixiHVCenter } from "./Utils/LibPixiHVCenter";
46
46
  import { libPixiHVGap } from "./Utils/LibPixiHVGap";
47
47
  import { LibDestroyContainer } from "./Components/Base/LibDestroyContainer";
48
+ import { LibDragLocate } from "./Components/Custom/LibDragLocate";
48
49
  /** @description 组件 */
49
50
  export const Components = {
50
51
  Base: {
@@ -144,10 +145,10 @@ export const Components = {
144
145
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
145
146
  */
146
147
  LibPixiLabelValue,
147
- /** @description 设计图背景拼接
148
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
149
- */
148
+ /** @description 设计图背景拼接 */
150
149
  LibPixiPuzzleBg,
150
+ /** @description 元素拖拽定位 */
151
+ LibDragLocate,
151
152
  },
152
153
  };
153
154
  /** @description 方法 */
package/lyb-pixi.js CHANGED
@@ -1315,7 +1315,7 @@
1315
1315
  var ys = arrObjKeys(obj, inspect2);
1316
1316
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
1317
1317
  var protoTag = obj instanceof Object ? "" : "null prototype";
1318
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
1318
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
1319
1319
  var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
1320
1320
  var tag2 = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
1321
1321
  if (ys.length === 0) {
@@ -1337,25 +1337,25 @@
1337
1337
  return $replace$1.call(String(s2), /"/g, """);
1338
1338
  }
1339
1339
  function isArray$3(obj) {
1340
- return toStr$1(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1340
+ return toStr(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1341
1341
  }
1342
1342
  function isDate(obj) {
1343
- return toStr$1(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1343
+ return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1344
1344
  }
1345
1345
  function isRegExp$1(obj) {
1346
- return toStr$1(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1346
+ return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1347
1347
  }
1348
1348
  function isError(obj) {
1349
- return toStr$1(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1349
+ return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1350
1350
  }
1351
1351
  function isString(obj) {
1352
- return toStr$1(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1352
+ return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1353
1353
  }
1354
1354
  function isNumber(obj) {
1355
- return toStr$1(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1355
+ return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1356
1356
  }
1357
1357
  function isBoolean(obj) {
1358
- return toStr$1(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1358
+ return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1359
1359
  }
1360
1360
  function isSymbol(obj) {
1361
1361
  if (hasShammedSymbols) {
@@ -1391,7 +1391,7 @@
1391
1391
  function has$3(obj, key) {
1392
1392
  return hasOwn$1.call(obj, key);
1393
1393
  }
1394
- function toStr$1(obj) {
1394
+ function toStr(obj) {
1395
1395
  return objectToString.call(obj);
1396
1396
  }
1397
1397
  function nameOf(f2) {
@@ -1700,7 +1700,7 @@
1700
1700
  var uri = URIError;
1701
1701
  var abs$2 = Math.abs;
1702
1702
  var floor$2 = Math.floor;
1703
- var max$3 = Math.max;
1703
+ var max$2 = Math.max;
1704
1704
  var min$2 = Math.min;
1705
1705
  var pow$2 = Math.pow;
1706
1706
  var round$3 = Math.round;
@@ -1833,78 +1833,102 @@
1833
1833
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
1834
1834
  return Object_getPrototypeOf;
1835
1835
  }
1836
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
1837
- var toStr = Object.prototype.toString;
1838
- var max$2 = Math.max;
1839
- var funcType = "[object Function]";
1840
- var concatty = function concatty2(a2, b2) {
1841
- var arr = [];
1842
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
1843
- arr[i2] = a2[i2];
1844
- }
1845
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
1846
- arr[j2 + a2.length] = b2[j2];
1847
- }
1848
- return arr;
1849
- };
1850
- var slicy = function slicy2(arrLike, offset) {
1851
- var arr = [];
1852
- for (var i2 = offset || 0, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
1853
- arr[j2] = arrLike[i2];
1854
- }
1855
- return arr;
1856
- };
1857
- var joiny = function(arr, joiner) {
1858
- var str = "";
1859
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
1860
- str += arr[i2];
1861
- if (i2 + 1 < arr.length) {
1862
- str += joiner;
1836
+ var implementation;
1837
+ var hasRequiredImplementation;
1838
+ function requireImplementation() {
1839
+ if (hasRequiredImplementation)
1840
+ return implementation;
1841
+ hasRequiredImplementation = 1;
1842
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
1843
+ var toStr2 = Object.prototype.toString;
1844
+ var max2 = Math.max;
1845
+ var funcType = "[object Function]";
1846
+ var concatty = function concatty2(a2, b2) {
1847
+ var arr = [];
1848
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
1849
+ arr[i2] = a2[i2];
1863
1850
  }
1864
- }
1865
- return str;
1866
- };
1867
- var implementation$1 = function bind2(that) {
1868
- var target = this;
1869
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
1870
- throw new TypeError(ERROR_MESSAGE + target);
1871
- }
1872
- var args = slicy(arguments, 1);
1873
- var bound;
1874
- var binder = function() {
1875
- if (this instanceof bound) {
1876
- var result = target.apply(
1877
- this,
1878
- concatty(args, arguments)
1879
- );
1880
- if (Object(result) === result) {
1881
- return result;
1851
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
1852
+ arr[j2 + a2.length] = b2[j2];
1853
+ }
1854
+ return arr;
1855
+ };
1856
+ var slicy = function slicy2(arrLike, offset) {
1857
+ var arr = [];
1858
+ for (var i2 = offset || 0, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
1859
+ arr[j2] = arrLike[i2];
1860
+ }
1861
+ return arr;
1862
+ };
1863
+ var joiny = function(arr, joiner) {
1864
+ var str = "";
1865
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
1866
+ str += arr[i2];
1867
+ if (i2 + 1 < arr.length) {
1868
+ str += joiner;
1882
1869
  }
1883
- return this;
1884
1870
  }
1885
- return target.apply(
1886
- that,
1887
- concatty(args, arguments)
1888
- );
1871
+ return str;
1889
1872
  };
1890
- var boundLength = max$2(0, target.length - args.length);
1891
- var boundArgs = [];
1892
- for (var i2 = 0; i2 < boundLength; i2++) {
1893
- boundArgs[i2] = "$" + i2;
1894
- }
1895
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
1896
- if (target.prototype) {
1897
- var Empty = function Empty2() {
1873
+ implementation = function bind2(that) {
1874
+ var target = this;
1875
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
1876
+ throw new TypeError(ERROR_MESSAGE + target);
1877
+ }
1878
+ var args = slicy(arguments, 1);
1879
+ var bound;
1880
+ var binder = function() {
1881
+ if (this instanceof bound) {
1882
+ var result = target.apply(
1883
+ this,
1884
+ concatty(args, arguments)
1885
+ );
1886
+ if (Object(result) === result) {
1887
+ return result;
1888
+ }
1889
+ return this;
1890
+ }
1891
+ return target.apply(
1892
+ that,
1893
+ concatty(args, arguments)
1894
+ );
1898
1895
  };
1899
- Empty.prototype = target.prototype;
1900
- bound.prototype = new Empty();
1901
- Empty.prototype = null;
1902
- }
1903
- return bound;
1904
- };
1905
- var implementation = implementation$1;
1906
- var functionBind = Function.prototype.bind || implementation;
1907
- var functionCall = Function.prototype.call;
1896
+ var boundLength = max2(0, target.length - args.length);
1897
+ var boundArgs = [];
1898
+ for (var i2 = 0; i2 < boundLength; i2++) {
1899
+ boundArgs[i2] = "$" + i2;
1900
+ }
1901
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
1902
+ if (target.prototype) {
1903
+ var Empty = function Empty2() {
1904
+ };
1905
+ Empty.prototype = target.prototype;
1906
+ bound.prototype = new Empty();
1907
+ Empty.prototype = null;
1908
+ }
1909
+ return bound;
1910
+ };
1911
+ return implementation;
1912
+ }
1913
+ var functionBind;
1914
+ var hasRequiredFunctionBind;
1915
+ function requireFunctionBind() {
1916
+ if (hasRequiredFunctionBind)
1917
+ return functionBind;
1918
+ hasRequiredFunctionBind = 1;
1919
+ var implementation2 = requireImplementation();
1920
+ functionBind = Function.prototype.bind || implementation2;
1921
+ return functionBind;
1922
+ }
1923
+ var functionCall;
1924
+ var hasRequiredFunctionCall;
1925
+ function requireFunctionCall() {
1926
+ if (hasRequiredFunctionCall)
1927
+ return functionCall;
1928
+ hasRequiredFunctionCall = 1;
1929
+ functionCall = Function.prototype.call;
1930
+ return functionCall;
1931
+ }
1908
1932
  var functionApply;
1909
1933
  var hasRequiredFunctionApply;
1910
1934
  function requireFunctionApply() {
@@ -1915,14 +1939,14 @@
1915
1939
  return functionApply;
1916
1940
  }
1917
1941
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
1918
- var bind$2 = functionBind;
1942
+ var bind$2 = requireFunctionBind();
1919
1943
  var $apply$1 = requireFunctionApply();
1920
- var $call$2 = functionCall;
1944
+ var $call$2 = requireFunctionCall();
1921
1945
  var $reflectApply = reflectApply;
1922
1946
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
1923
- var bind$1 = functionBind;
1947
+ var bind$1 = requireFunctionBind();
1924
1948
  var $TypeError$4 = type;
1925
- var $call$1 = functionCall;
1949
+ var $call$1 = requireFunctionCall();
1926
1950
  var $actualApply = actualApply;
1927
1951
  var callBindApplyHelpers = function callBindBasic2(args) {
1928
1952
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -1991,7 +2015,7 @@
1991
2015
  hasRequiredHasown = 1;
1992
2016
  var call = Function.prototype.call;
1993
2017
  var $hasOwn = Object.prototype.hasOwnProperty;
1994
- var bind2 = functionBind;
2018
+ var bind2 = requireFunctionBind();
1995
2019
  hasown = bind2.call(call, $hasOwn);
1996
2020
  return hasown;
1997
2021
  }
@@ -2006,7 +2030,7 @@
2006
2030
  var $URIError = uri;
2007
2031
  var abs$1 = abs$2;
2008
2032
  var floor$1 = floor$2;
2009
- var max$1 = max$3;
2033
+ var max$1 = max$2;
2010
2034
  var min$1 = min$2;
2011
2035
  var pow$1 = pow$2;
2012
2036
  var round$2 = round$3;
@@ -2040,7 +2064,7 @@
2040
2064
  var $ObjectGPO = requireObject_getPrototypeOf();
2041
2065
  var $ReflectGPO = requireReflect_getPrototypeOf();
2042
2066
  var $apply = requireFunctionApply();
2043
- var $call = functionCall;
2067
+ var $call = requireFunctionCall();
2044
2068
  var needsEval = {};
2045
2069
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
2046
2070
  var INTRINSICS = {
@@ -2210,7 +2234,7 @@
2210
2234
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
2211
2235
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
2212
2236
  };
2213
- var bind = functionBind;
2237
+ var bind = requireFunctionBind();
2214
2238
  var hasOwn = requireHasown();
2215
2239
  var $concat = bind.call($call, Array.prototype.concat);
2216
2240
  var $spliceApply = bind.call($apply, Array.prototype.splice);
@@ -57761,7 +57785,7 @@ void main(void){
57761
57785
  bg.alpha = alpha || 0.25;
57762
57786
  bg.position.set(x2 || 0, y2 || 0);
57763
57787
  document.addEventListener("keydown", (e2) => {
57764
- if (e2.code === "Space") {
57788
+ if (e2.altKey && e2.code === "Space") {
57765
57789
  bg.visible = !bg.visible;
57766
57790
  } else if (e2.code === "ArrowUp") {
57767
57791
  bg.y -= 2;
@@ -57777,7 +57801,10 @@ void main(void){
57777
57801
  } else if (e2.code === "NumpadSubtract" && bg.alpha > 0) {
57778
57802
  bg.alpha = libJsDecimal(bg.alpha, 0.1, "-");
57779
57803
  }
57780
- localStorage.setItem("puzzle_bg_config", JSON.stringify({ alpha: bg.alpha, x: bg.x, y: bg.y }));
57804
+ localStorage.setItem(
57805
+ "puzzle_bg_config",
57806
+ JSON.stringify({ alpha: bg.alpha, x: bg.x, y: bg.y })
57807
+ );
57781
57808
  });
57782
57809
  }
57783
57810
  }
@@ -57828,6 +57855,246 @@ void main(void){
57828
57855
  (_b = this._onDestroyed) == null ? void 0 : _b.call(this);
57829
57856
  }
57830
57857
  }
57858
+ const fallbackCopy = (text) => {
57859
+ const textarea = document.createElement("textarea");
57860
+ textarea.value = text;
57861
+ textarea.style.position = "fixed";
57862
+ textarea.style.opacity = "0";
57863
+ document.body.appendChild(textarea);
57864
+ textarea.select();
57865
+ document.execCommand("copy");
57866
+ document.body.removeChild(textarea);
57867
+ };
57868
+ const libJsCopy = (text) => {
57869
+ if (navigator.clipboard) {
57870
+ navigator.clipboard.writeText(text).catch(() => fallbackCopy(text));
57871
+ } else {
57872
+ fallbackCopy(text);
57873
+ }
57874
+ };
57875
+ class LibDragLocate extends Container {
57876
+ constructor() {
57877
+ super();
57878
+ this._positionValue = "";
57879
+ this._isLocalte = false;
57880
+ this._showInput = false;
57881
+ this._allowMove = false;
57882
+ this._downPos = { x: 0, y: 0 };
57883
+ window.addEventListener("keydown", (e2) => {
57884
+ if (e2.altKey && e2.key.toLowerCase() === "q") {
57885
+ if (this._isLocalte)
57886
+ return;
57887
+ this._showInput = true;
57888
+ e2.preventDefault();
57889
+ }
57890
+ if (e2.key === "Escape") {
57891
+ this._showInput = false;
57892
+ }
57893
+ });
57894
+ this._createInput();
57895
+ this._createResultList();
57896
+ this._createStatusBar();
57897
+ LibDragLocate.stage.on("pointerdown", (event) => {
57898
+ if (!this._currentMoveContainer)
57899
+ return;
57900
+ this._allowMove = true;
57901
+ const { x: x2, y: y2 } = LibDragLocate.stage.toLocal(event.global);
57902
+ this._downPos = { x: x2, y: y2 };
57903
+ });
57904
+ LibDragLocate.stage.on("pointermove", (event) => {
57905
+ if (!this._allowMove || !this._currentMoveContainer)
57906
+ return;
57907
+ const { x: x2, y: y2 } = LibDragLocate.stage.toLocal(event.global);
57908
+ const dx = x2 - this._downPos.x;
57909
+ const dy = y2 - this._downPos.y;
57910
+ this._currentMoveContainer.x += dx;
57911
+ this._currentMoveContainer.y += dy;
57912
+ this._downPos = { x: x2, y: y2 };
57913
+ const posX = Math.round(this._currentMoveContainer.x);
57914
+ const posY = Math.round(this._currentMoveContainer.y);
57915
+ this._positionEl.textContent = `X: ${posX}, Y: ${posY}`;
57916
+ this._positionValue = `xxx.position.set(${posX}, ${posY})`;
57917
+ });
57918
+ LibDragLocate.stage.on(
57919
+ "pointerup",
57920
+ () => {
57921
+ this._allowMove = false;
57922
+ },
57923
+ this
57924
+ );
57925
+ Ticker.shared.add(() => {
57926
+ if (this._showInput) {
57927
+ if (this._isLocalte) {
57928
+ this._inputEl.style.display = "none";
57929
+ this._resultEl.style.display = "none";
57930
+ this._statusBarEl.style.display = "flex";
57931
+ } else {
57932
+ this._inputEl.style.display = "block";
57933
+ this._resultEl.style.display = "flex";
57934
+ this._statusBarEl.style.display = "none";
57935
+ this._inputEl.focus();
57936
+ }
57937
+ } else {
57938
+ this._inputEl.style.display = "none";
57939
+ this._resultEl.style.display = "none";
57940
+ }
57941
+ });
57942
+ }
57943
+ /** @description 创建输入框 */
57944
+ _createInput() {
57945
+ this._inputEl = document.createElement("input");
57946
+ this._inputEl.type = "text";
57947
+ this._inputEl.style.cssText = `
57948
+ background-color: rgba(0,0,0,0.75);
57949
+ border: 2px solid rgba(255,255,255,0.5);
57950
+ color: #fff;
57951
+ display: none;
57952
+ font-size: 25px;
57953
+ height: 50px;
57954
+ left: 50%;
57955
+ outline: none;
57956
+ position: fixed;
57957
+ text-align: center;
57958
+ top: 25%;
57959
+ transform: translate(-50%, -50%);
57960
+ width: 50vw;
57961
+ `;
57962
+ document.body.appendChild(this._inputEl);
57963
+ this._inputEl.addEventListener("input", () => {
57964
+ const results = this._findByName(
57965
+ LibDragLocate.stage,
57966
+ this._inputEl.value
57967
+ );
57968
+ this._resultEl.innerHTML = "";
57969
+ const renderNode = (item) => {
57970
+ const resultEl = this._createResultEl(
57971
+ item.node.constructor.name,
57972
+ item.node.name,
57973
+ item.depth
57974
+ );
57975
+ this._resultEl.appendChild(resultEl);
57976
+ gsapWithCSS.killTweensOf(item.node);
57977
+ resultEl.addEventListener("mouseenter", () => {
57978
+ gsapWithCSS.to(item.node, {
57979
+ alpha: 0,
57980
+ duration: 0.25,
57981
+ yoyo: true,
57982
+ ease: "none",
57983
+ repeat: -1
57984
+ });
57985
+ });
57986
+ resultEl.addEventListener("mouseleave", () => {
57987
+ gsapWithCSS.killTweensOf(item.node);
57988
+ item.node.alpha = 1;
57989
+ });
57990
+ resultEl.addEventListener("click", () => {
57991
+ gsapWithCSS.killTweensOf(item.node);
57992
+ this._currentMoveContainer = item.node;
57993
+ item.node.alpha = 1;
57994
+ item.node.filters = [libPixiFilter("desaturate", 0)];
57995
+ this._isLocalte = true;
57996
+ });
57997
+ item.children.forEach(renderNode);
57998
+ };
57999
+ results.forEach(renderNode);
58000
+ });
58001
+ }
58002
+ /** @description 创建用于展示搜索结果的列表 */
58003
+ _createResultList() {
58004
+ this._resultEl = document.createElement("div");
58005
+ this._resultEl.style.cssText = `
58006
+ background-color: rgba(0,0,0,0.75);
58007
+ border: 2px solid rgba(255,255,255,0.5);
58008
+ left: 50%;
58009
+ transform: translateX(-50%);
58010
+ height: 300px;
58011
+ overflow-y: auto;
58012
+ position: fixed;
58013
+ display: none;
58014
+ gap: 10px;
58015
+ flex-direction: column;
58016
+ top: calc(25% + 50px);
58017
+ width: 50vw;
58018
+ `;
58019
+ document.body.appendChild(this._resultEl);
58020
+ }
58021
+ /** @description 创建搜索结果元素 */
58022
+ _createResultEl(className, tagName, depth) {
58023
+ const resultItem = document.createElement("div");
58024
+ resultItem.style.cssText = `
58025
+ display: flex;
58026
+ justify-content: space-between;
58027
+ padding: 5px 10px;
58028
+ align-items: center;
58029
+ width: 100%;
58030
+ font-size: 25px;
58031
+ background-color: rgba(255,255,255,0.1);
58032
+ color: #fff;
58033
+ padding-left: ${depth * 20}px;
58034
+ `;
58035
+ const classNameEl = document.createElement("div");
58036
+ classNameEl.textContent = className;
58037
+ resultItem.appendChild(classNameEl);
58038
+ const tagNameEl = document.createElement("div");
58039
+ tagNameEl.textContent = tagName;
58040
+ resultItem.appendChild(tagNameEl);
58041
+ return resultItem;
58042
+ }
58043
+ /** @description 创建状态栏 */
58044
+ _createStatusBar() {
58045
+ this._statusBarEl = document.createElement("div");
58046
+ this._statusBarEl.style.cssText = `
58047
+ align-items: center;
58048
+ background-color: rgba(0,0,0,0.75);
58049
+ border: 2px solid rgba(0, 255, 13, 0.5);
58050
+ color: #fff;
58051
+ display: none;
58052
+ font-size: 25px;
58053
+ justify-content: center;
58054
+ position: fixed;
58055
+ top: 25%;
58056
+ height: 50px;
58057
+ left: 50%;
58058
+ transform: translate(-50%, -50%);
58059
+ width: 50vw;
58060
+ `;
58061
+ this._positionEl = document.createElement("div");
58062
+ this._statusBarEl.appendChild(this._positionEl);
58063
+ document.body.appendChild(this._statusBarEl);
58064
+ this._statusBarEl.addEventListener("click", () => {
58065
+ this._isLocalte = false;
58066
+ libJsCopy(this._positionValue);
58067
+ if (this._currentMoveContainer) {
58068
+ this._currentMoveContainer.filters = [];
58069
+ this._currentMoveContainer = void 0;
58070
+ }
58071
+ });
58072
+ }
58073
+ /** @description 递归搜索 */
58074
+ _findByName(root, keyword) {
58075
+ if (!keyword)
58076
+ return [];
58077
+ const match = (node) => {
58078
+ var _a;
58079
+ return ((_a = node.name) == null ? void 0 : _a.toLowerCase().includes(keyword.toLowerCase())) || node.constructor.name.toLowerCase().includes(keyword.toLowerCase());
58080
+ };
58081
+ const dfs = (node, depth) => {
58082
+ const children = node.children.filter((c2) => c2 instanceof Container).flatMap((c2) => dfs(c2, depth + 1));
58083
+ if (match(node) || children.length > 0) {
58084
+ return [
58085
+ {
58086
+ node,
58087
+ depth,
58088
+ children,
58089
+ expanded: true
58090
+ }
58091
+ ];
58092
+ }
58093
+ return [];
58094
+ };
58095
+ return dfs(root, 0);
58096
+ }
58097
+ }
57831
58098
  const Components = {
57832
58099
  Base: {
57833
58100
  /** @description 自定义位图文本
@@ -57926,10 +58193,10 @@ void main(void){
57926
58193
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiLabelValue-标签值
57927
58194
  */
57928
58195
  LibPixiLabelValue,
57929
- /** @description 设计图背景拼接
57930
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPuzzleBg-设计图背景拼接
57931
- */
57932
- LibPixiPuzzleBg
58196
+ /** @description 设计图背景拼接 */
58197
+ LibPixiPuzzleBg,
58198
+ /** @description 元素拖拽定位 */
58199
+ LibDragLocate
57933
58200
  }
57934
58201
  };
57935
58202
  const Utils = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.11.10",
3
+ "version": "1.11.12",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {