lyb-pixi-js 1.9.4 → 1.9.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/Components/Base/LibPixiSpine.js +2 -2
- package/Components/Custom/LibPixiSlide.d.ts +92 -0
- package/Components/Custom/LibPixiSlide.js +281 -0
- package/libPixiJs.d.ts +41 -114
- package/libPixiJs.js +41 -114
- package/lyb-pixi.js +360 -225
- package/package.json +1 -1
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(obj), 8, -1) : protoTag ? "Object" : "";
|
|
1318
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
|
|
1319
1319
|
var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
1320
1320
|
var tag = 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(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1340
|
+
return toStr$1(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1341
1341
|
}
|
|
1342
1342
|
function isDate(obj) {
|
|
1343
|
-
return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1343
|
+
return toStr$1(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1344
1344
|
}
|
|
1345
1345
|
function isRegExp$1(obj) {
|
|
1346
|
-
return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1346
|
+
return toStr$1(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1347
1347
|
}
|
|
1348
1348
|
function isError(obj) {
|
|
1349
|
-
return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1349
|
+
return toStr$1(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1350
1350
|
}
|
|
1351
1351
|
function isString(obj) {
|
|
1352
|
-
return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1352
|
+
return toStr$1(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1353
1353
|
}
|
|
1354
1354
|
function isNumber(obj) {
|
|
1355
|
-
return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1355
|
+
return toStr$1(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1356
1356
|
}
|
|
1357
1357
|
function isBoolean(obj) {
|
|
1358
|
-
return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
|
|
1358
|
+
return toStr$1(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(obj) {
|
|
1394
|
+
function toStr$1(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$1 = Math.abs;
|
|
1702
1702
|
var floor$1 = Math.floor;
|
|
1703
|
-
var max$
|
|
1703
|
+
var max$2 = Math.max;
|
|
1704
1704
|
var min$1 = Math.min;
|
|
1705
1705
|
var pow$1 = Math.pow;
|
|
1706
1706
|
var round$2 = Math.round;
|
|
@@ -1833,102 +1833,78 @@
|
|
|
1833
1833
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
1834
1834
|
return Object_getPrototypeOf;
|
|
1835
1835
|
}
|
|
1836
|
-
var
|
|
1837
|
-
var
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
var
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
var
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
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;
|
|
1869
|
-
}
|
|
1836
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
1837
|
+
var toStr = Object.prototype.toString;
|
|
1838
|
+
var max$1 = 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;
|
|
1870
1863
|
}
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
);
|
|
1886
|
-
if (Object(result) === result) {
|
|
1887
|
-
return result;
|
|
1888
|
-
}
|
|
1889
|
-
return this;
|
|
1890
|
-
}
|
|
1891
|
-
return target.apply(
|
|
1892
|
-
that,
|
|
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,
|
|
1893
1878
|
concatty(args, arguments)
|
|
1894
1879
|
);
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
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;
|
|
1880
|
+
if (Object(result) === result) {
|
|
1881
|
+
return result;
|
|
1882
|
+
}
|
|
1883
|
+
return this;
|
|
1908
1884
|
}
|
|
1909
|
-
return
|
|
1885
|
+
return target.apply(
|
|
1886
|
+
that,
|
|
1887
|
+
concatty(args, arguments)
|
|
1888
|
+
);
|
|
1910
1889
|
};
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
functionCall = Function.prototype.call;
|
|
1930
|
-
return functionCall;
|
|
1931
|
-
}
|
|
1890
|
+
var boundLength = max$1(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() {
|
|
1898
|
+
};
|
|
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;
|
|
1932
1908
|
var functionApply;
|
|
1933
1909
|
var hasRequiredFunctionApply;
|
|
1934
1910
|
function requireFunctionApply() {
|
|
@@ -1939,14 +1915,14 @@
|
|
|
1939
1915
|
return functionApply;
|
|
1940
1916
|
}
|
|
1941
1917
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
1942
|
-
var bind$2 =
|
|
1918
|
+
var bind$2 = functionBind;
|
|
1943
1919
|
var $apply$1 = requireFunctionApply();
|
|
1944
|
-
var $call$2 =
|
|
1920
|
+
var $call$2 = functionCall;
|
|
1945
1921
|
var $reflectApply = reflectApply;
|
|
1946
1922
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
1947
|
-
var bind$1 =
|
|
1923
|
+
var bind$1 = functionBind;
|
|
1948
1924
|
var $TypeError$4 = type;
|
|
1949
|
-
var $call$1 =
|
|
1925
|
+
var $call$1 = functionCall;
|
|
1950
1926
|
var $actualApply = actualApply;
|
|
1951
1927
|
var callBindApplyHelpers = function callBindBasic2(args) {
|
|
1952
1928
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -2015,7 +1991,7 @@
|
|
|
2015
1991
|
hasRequiredHasown = 1;
|
|
2016
1992
|
var call = Function.prototype.call;
|
|
2017
1993
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
2018
|
-
var bind2 =
|
|
1994
|
+
var bind2 = functionBind;
|
|
2019
1995
|
hasown = bind2.call(call, $hasOwn);
|
|
2020
1996
|
return hasown;
|
|
2021
1997
|
}
|
|
@@ -2030,7 +2006,7 @@
|
|
|
2030
2006
|
var $URIError = uri;
|
|
2031
2007
|
var abs = abs$1;
|
|
2032
2008
|
var floor = floor$1;
|
|
2033
|
-
var max = max$
|
|
2009
|
+
var max = max$2;
|
|
2034
2010
|
var min = min$1;
|
|
2035
2011
|
var pow = pow$1;
|
|
2036
2012
|
var round$1 = round$2;
|
|
@@ -2064,7 +2040,7 @@
|
|
|
2064
2040
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
2065
2041
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
2066
2042
|
var $apply = requireFunctionApply();
|
|
2067
|
-
var $call =
|
|
2043
|
+
var $call = functionCall;
|
|
2068
2044
|
var needsEval = {};
|
|
2069
2045
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
2070
2046
|
var INTRINSICS = {
|
|
@@ -2234,7 +2210,7 @@
|
|
|
2234
2210
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
2235
2211
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
2236
2212
|
};
|
|
2237
|
-
var bind =
|
|
2213
|
+
var bind = functionBind;
|
|
2238
2214
|
var hasOwn = requireHasown();
|
|
2239
2215
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
2240
2216
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
@@ -48678,7 +48654,7 @@ void main(void)\r
|
|
|
48678
48654
|
super(spineData);
|
|
48679
48655
|
this._followDots = [];
|
|
48680
48656
|
this._isStart = false;
|
|
48681
|
-
this.
|
|
48657
|
+
this.alpha = visible ? 1 : 0;
|
|
48682
48658
|
this.autoUpdate = false;
|
|
48683
48659
|
if (followPointList == null ? void 0 : followPointList.length) {
|
|
48684
48660
|
followPointList == null ? void 0 : followPointList.forEach((item) => {
|
|
@@ -48707,7 +48683,7 @@ void main(void)\r
|
|
|
48707
48683
|
}
|
|
48708
48684
|
};
|
|
48709
48685
|
setTimeout(() => {
|
|
48710
|
-
this.
|
|
48686
|
+
this.alpha = 1;
|
|
48711
48687
|
});
|
|
48712
48688
|
});
|
|
48713
48689
|
}
|
|
@@ -55124,192 +55100,351 @@ void main(void){
|
|
|
55124
55100
|
}
|
|
55125
55101
|
});
|
|
55126
55102
|
};
|
|
55103
|
+
class LibPixiSlide extends LibPixiContainer {
|
|
55104
|
+
constructor(params) {
|
|
55105
|
+
const {
|
|
55106
|
+
stage,
|
|
55107
|
+
width,
|
|
55108
|
+
height,
|
|
55109
|
+
content,
|
|
55110
|
+
depthCallback,
|
|
55111
|
+
slideCallback,
|
|
55112
|
+
scrollCallback,
|
|
55113
|
+
pageWidth = 0,
|
|
55114
|
+
pageHeight = 0,
|
|
55115
|
+
itemList,
|
|
55116
|
+
loop = false,
|
|
55117
|
+
direction
|
|
55118
|
+
} = params;
|
|
55119
|
+
super(width, height);
|
|
55120
|
+
this._SPEED_THRESHOLD = 0.35;
|
|
55121
|
+
this._SCROLL_THRESHOLD = 0.5;
|
|
55122
|
+
this._pageWidth = 0;
|
|
55123
|
+
this._pageHeight = 0;
|
|
55124
|
+
this._loop = false;
|
|
55125
|
+
this._freeGridNum = 0;
|
|
55126
|
+
this._currentIndex = 0;
|
|
55127
|
+
this._startX = 0;
|
|
55128
|
+
this._startY = 0;
|
|
55129
|
+
this._offsetX = 0;
|
|
55130
|
+
this._offsetY = 0;
|
|
55131
|
+
this._pageNum = 0;
|
|
55132
|
+
this._startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
55133
|
+
this._isDragging = false;
|
|
55134
|
+
const mask = new Graphics();
|
|
55135
|
+
mask.beginFill(16777215);
|
|
55136
|
+
mask.drawRect(0, 0, this.width, this.height);
|
|
55137
|
+
mask.endFill();
|
|
55138
|
+
this.addChild(mask);
|
|
55139
|
+
this.mask = mask;
|
|
55140
|
+
this._direction = direction;
|
|
55141
|
+
this._pageWidth = pageWidth;
|
|
55142
|
+
this._pageHeight = pageHeight;
|
|
55143
|
+
this._slideArea = content;
|
|
55144
|
+
this._itemList = itemList;
|
|
55145
|
+
this._loop = loop;
|
|
55146
|
+
this._depthCallback = depthCallback;
|
|
55147
|
+
this._slideCallback = slideCallback;
|
|
55148
|
+
this._scrollCallback = scrollCallback;
|
|
55149
|
+
this._pageNum = itemList.length;
|
|
55150
|
+
this.addChild(this._slideArea);
|
|
55151
|
+
if (this._direction === "x") {
|
|
55152
|
+
this._freeGridNum = Math.floor(width / this._pageWidth / 2);
|
|
55153
|
+
this._slideArea.x = this._pageWidth * this._freeGridNum;
|
|
55154
|
+
} else {
|
|
55155
|
+
this._freeGridNum = Math.floor(height / pageHeight / 2);
|
|
55156
|
+
this._slideArea.y = this._pageHeight * this._freeGridNum;
|
|
55157
|
+
}
|
|
55158
|
+
this.eventMode = "static";
|
|
55159
|
+
this.cursor = "pointer";
|
|
55160
|
+
this._setDepth();
|
|
55161
|
+
libPixiEvent(this, "pointerdown", this._onDragStart.bind(this));
|
|
55162
|
+
libPixiEvent(stage, "pointermove", this._onDragMove.bind(this));
|
|
55163
|
+
window.addEventListener("pointerup", this._onDragEnd.bind(this));
|
|
55164
|
+
}
|
|
55165
|
+
/** @description 更新坐标 */
|
|
55166
|
+
updatePosition(v2, index) {
|
|
55167
|
+
this._currentIndex = index;
|
|
55168
|
+
this._setDepth();
|
|
55169
|
+
if (this._direction === "x") {
|
|
55170
|
+
this._slideArea.x = v2;
|
|
55171
|
+
} else {
|
|
55172
|
+
this._slideArea.y = v2;
|
|
55173
|
+
}
|
|
55174
|
+
}
|
|
55175
|
+
/** @description 上一页 */
|
|
55176
|
+
prev() {
|
|
55177
|
+
this.slideTo(this._currentIndex - 1);
|
|
55178
|
+
}
|
|
55179
|
+
/** @description 下一页 */
|
|
55180
|
+
next() {
|
|
55181
|
+
this.slideTo(this._currentIndex + 1);
|
|
55182
|
+
}
|
|
55183
|
+
/** @description 滑动到指定索引 */
|
|
55184
|
+
slideTo(index) {
|
|
55185
|
+
var _a;
|
|
55186
|
+
this._currentIndex = index;
|
|
55187
|
+
if (this._currentIndex < 0) {
|
|
55188
|
+
if (this._loop) {
|
|
55189
|
+
this._currentIndex = this._pageNum - 1;
|
|
55190
|
+
} else {
|
|
55191
|
+
this._currentIndex = 0;
|
|
55192
|
+
}
|
|
55193
|
+
} else if (this._currentIndex >= this._pageNum) {
|
|
55194
|
+
this._currentIndex = this._pageNum;
|
|
55195
|
+
if (this._loop) {
|
|
55196
|
+
this._currentIndex = 0;
|
|
55197
|
+
} else {
|
|
55198
|
+
this._currentIndex--;
|
|
55199
|
+
}
|
|
55200
|
+
}
|
|
55201
|
+
if (this._direction === "x") {
|
|
55202
|
+
gsapWithCSS.to(this._slideArea, {
|
|
55203
|
+
x: -this._currentIndex * this._pageWidth + this._pageWidth * this._freeGridNum,
|
|
55204
|
+
duration: 0.25,
|
|
55205
|
+
onUpdate: () => {
|
|
55206
|
+
this._onScroll();
|
|
55207
|
+
}
|
|
55208
|
+
});
|
|
55209
|
+
} else {
|
|
55210
|
+
gsapWithCSS.to(this._slideArea, {
|
|
55211
|
+
y: -this._currentIndex * this._pageHeight + this._pageHeight * this._freeGridNum,
|
|
55212
|
+
duration: 0.25,
|
|
55213
|
+
onUpdate: () => {
|
|
55214
|
+
this._onScroll();
|
|
55215
|
+
}
|
|
55216
|
+
});
|
|
55217
|
+
}
|
|
55218
|
+
(_a = this._slideCallback) == null ? void 0 : _a.call(this, this._currentIndex);
|
|
55219
|
+
}
|
|
55220
|
+
/** @description 设置滚动景深 */
|
|
55221
|
+
_setDepth() {
|
|
55222
|
+
if (!this._depthCallback)
|
|
55223
|
+
return;
|
|
55224
|
+
let t2 = 0;
|
|
55225
|
+
let currentIndex = 0;
|
|
55226
|
+
if (this._direction === "x") {
|
|
55227
|
+
const x2 = this._slideArea.x;
|
|
55228
|
+
const startX = this._freeGridNum * this._pageWidth;
|
|
55229
|
+
const absX = Math.abs(x2 - startX);
|
|
55230
|
+
currentIndex = Math.floor(absX / this._pageWidth);
|
|
55231
|
+
t2 = absX % this._pageWidth / this._pageWidth;
|
|
55232
|
+
if (x2 - startX > 0) {
|
|
55233
|
+
t2 = -t2;
|
|
55234
|
+
currentIndex = -currentIndex;
|
|
55235
|
+
}
|
|
55236
|
+
} else {
|
|
55237
|
+
const y2 = this._slideArea.y;
|
|
55238
|
+
const startY = this._freeGridNum * this._pageHeight;
|
|
55239
|
+
const absY = Math.abs(y2 - startY);
|
|
55240
|
+
currentIndex = Math.floor(absY / this._pageHeight);
|
|
55241
|
+
t2 = absY % this._pageHeight / this._pageHeight;
|
|
55242
|
+
if (y2 - startY > 0) {
|
|
55243
|
+
t2 = -t2;
|
|
55244
|
+
currentIndex = -currentIndex;
|
|
55245
|
+
}
|
|
55246
|
+
}
|
|
55247
|
+
this._itemList.forEach((item, i2) => {
|
|
55248
|
+
var _a;
|
|
55249
|
+
const distance = Math.abs(i2 - currentIndex - t2);
|
|
55250
|
+
(_a = this._depthCallback) == null ? void 0 : _a.call(this, item, (depthAtten) => {
|
|
55251
|
+
return Math.max(0, 1 - distance * depthAtten);
|
|
55252
|
+
});
|
|
55253
|
+
});
|
|
55254
|
+
}
|
|
55255
|
+
/** @description 开始拖动 */
|
|
55256
|
+
_onDragStart(event) {
|
|
55257
|
+
this._isDragging = true;
|
|
55258
|
+
gsapWithCSS.killTweensOf(this._slideArea);
|
|
55259
|
+
this._startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
55260
|
+
if (this._direction === "x") {
|
|
55261
|
+
this._startX = event.global.x;
|
|
55262
|
+
this._offsetX = this._slideArea.x;
|
|
55263
|
+
} else {
|
|
55264
|
+
this._startY = event.global.y;
|
|
55265
|
+
this._offsetY = this._slideArea.y;
|
|
55266
|
+
}
|
|
55267
|
+
}
|
|
55268
|
+
/** @description 拖动中 */
|
|
55269
|
+
_onDragMove(event) {
|
|
55270
|
+
if (!this._isDragging)
|
|
55271
|
+
return;
|
|
55272
|
+
if (this._direction === "x") {
|
|
55273
|
+
const moveX = event.pageX - this._startX;
|
|
55274
|
+
this._slideArea.x = this._offsetX + moveX;
|
|
55275
|
+
} else {
|
|
55276
|
+
const moveY = event.pageY - this._startY;
|
|
55277
|
+
this._slideArea.y = this._offsetY + moveY;
|
|
55278
|
+
}
|
|
55279
|
+
this._onScroll();
|
|
55280
|
+
}
|
|
55281
|
+
/** @description 滚动触发 */
|
|
55282
|
+
_onScroll() {
|
|
55283
|
+
var _a, _b;
|
|
55284
|
+
this._setDepth();
|
|
55285
|
+
if (this._direction === "x") {
|
|
55286
|
+
(_a = this._scrollCallback) == null ? void 0 : _a.call(this, this._slideArea.x, this._currentIndex);
|
|
55287
|
+
} else {
|
|
55288
|
+
(_b = this._scrollCallback) == null ? void 0 : _b.call(this, this._slideArea.y, this._currentIndex);
|
|
55289
|
+
}
|
|
55290
|
+
}
|
|
55291
|
+
/** @description 结束拖动 */
|
|
55292
|
+
_onDragEnd(event) {
|
|
55293
|
+
if (this._direction === "x") {
|
|
55294
|
+
if (!this._isDragging)
|
|
55295
|
+
return;
|
|
55296
|
+
this._isDragging = false;
|
|
55297
|
+
const slideTime = (/* @__PURE__ */ new Date()).getTime() - this._startTime;
|
|
55298
|
+
const slide = this._startX - event.pageX;
|
|
55299
|
+
const slideSpeed = Math.abs(slide) / slideTime;
|
|
55300
|
+
const pageChange = Math.round(slide / this._pageWidth);
|
|
55301
|
+
if (Math.abs(slide) > this._pageWidth * this._SCROLL_THRESHOLD) {
|
|
55302
|
+
this._currentIndex += pageChange;
|
|
55303
|
+
} else if (slideSpeed > this._SPEED_THRESHOLD) {
|
|
55304
|
+
let addIndex = slide / this._pageWidth;
|
|
55305
|
+
if (addIndex > 0) {
|
|
55306
|
+
addIndex = Math.ceil(addIndex);
|
|
55307
|
+
} else {
|
|
55308
|
+
addIndex = Math.floor(addIndex);
|
|
55309
|
+
}
|
|
55310
|
+
this._currentIndex += addIndex;
|
|
55311
|
+
}
|
|
55312
|
+
this.slideTo(this._currentIndex);
|
|
55313
|
+
} else {
|
|
55314
|
+
if (!this._isDragging)
|
|
55315
|
+
return;
|
|
55316
|
+
this._isDragging = false;
|
|
55317
|
+
const slideTime = (/* @__PURE__ */ new Date()).getTime() - this._startTime;
|
|
55318
|
+
const slide = this._startY - event.pageY;
|
|
55319
|
+
const slideSpeed = Math.abs(slide) / slideTime;
|
|
55320
|
+
const pageChange = Math.round(slide / this._pageHeight);
|
|
55321
|
+
if (Math.abs(slide) > this._pageHeight * this._SCROLL_THRESHOLD) {
|
|
55322
|
+
this._currentIndex += pageChange;
|
|
55323
|
+
} else if (slideSpeed > this._SPEED_THRESHOLD) {
|
|
55324
|
+
let addIndex = slide / this._pageHeight;
|
|
55325
|
+
if (addIndex > 0) {
|
|
55326
|
+
addIndex = Math.ceil(addIndex);
|
|
55327
|
+
} else {
|
|
55328
|
+
addIndex = Math.floor(addIndex);
|
|
55329
|
+
}
|
|
55330
|
+
this._currentIndex += addIndex;
|
|
55331
|
+
}
|
|
55332
|
+
this.slideTo(this._currentIndex);
|
|
55333
|
+
}
|
|
55334
|
+
}
|
|
55335
|
+
}
|
|
55127
55336
|
const Components = {
|
|
55128
55337
|
Base: {
|
|
55129
|
-
/** @description 自定义位图文本
|
|
55130
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiBitText-位图
|
|
55131
|
-
*/
|
|
55338
|
+
/** @description 自定义位图文本 */
|
|
55132
55339
|
LibPixiBitText,
|
|
55133
|
-
/** @description 自定义容器大小及背景色
|
|
55134
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiContainer-容器
|
|
55135
|
-
*/
|
|
55340
|
+
/** @description 自定义容器大小及背景色 */
|
|
55136
55341
|
LibPixiContainer,
|
|
55137
|
-
/** @description 利用贝塞尔曲线实现粒子移动
|
|
55138
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
|
|
55139
|
-
*/
|
|
55342
|
+
/** @description 利用贝塞尔曲线实现粒子移动 */
|
|
55140
55343
|
LibPixiParticleMove,
|
|
55141
|
-
/** @description 自定义矩形背景色
|
|
55142
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectBgColor-矩形
|
|
55143
|
-
*/
|
|
55344
|
+
/** @description 自定义矩形背景色 */
|
|
55144
55345
|
LibPixiRectBgColor,
|
|
55145
|
-
/** @description 矩形类,可用于一些场景的局部点击,传颜色是为了方便定位,最终可能需要将颜色隐藏掉
|
|
55146
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectangle-矩形
|
|
55147
|
-
*/
|
|
55346
|
+
/** @description 矩形类,可用于一些场景的局部点击,传颜色是为了方便定位,最终可能需要将颜色隐藏掉 */
|
|
55148
55347
|
LibPixiRectangle,
|
|
55149
|
-
/** @description 圆形
|
|
55150
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCircular-圆形
|
|
55151
|
-
*/
|
|
55348
|
+
/** @description 圆形 */
|
|
55152
55349
|
LibPixiCircular,
|
|
55153
|
-
/** @description 多边形类
|
|
55154
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygon-多边形
|
|
55155
|
-
*/
|
|
55350
|
+
/** @description 多边形类 */
|
|
55156
55351
|
LibPixiPolygon,
|
|
55157
|
-
/** @description 自定义 Spine 动画
|
|
55158
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
|
|
55159
|
-
*/
|
|
55352
|
+
/** @description 自定义 Spine 动画 */
|
|
55160
55353
|
LibPixiSpine,
|
|
55161
|
-
/** @description 自定义文本类
|
|
55162
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
|
|
55163
|
-
*/
|
|
55354
|
+
/** @description 自定义文本类 */
|
|
55164
55355
|
LibPixiText,
|
|
55165
|
-
/** @description 自定义富文本类
|
|
55166
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
|
|
55167
|
-
*/
|
|
55356
|
+
/** @description 自定义富文本类 */
|
|
55168
55357
|
LibPixiHtmlText
|
|
55169
55358
|
},
|
|
55170
55359
|
Custom: {
|
|
55171
|
-
/** @description 悬浮切换材质
|
|
55172
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiButtonHover-按钮悬浮
|
|
55173
|
-
*/
|
|
55360
|
+
/** @description 悬浮切换材质 */
|
|
55174
55361
|
LibPixiButtonHover,
|
|
55175
|
-
/** @description 右上角关闭按钮,支持悬浮旋转动画
|
|
55176
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCloseBtn-关闭按钮
|
|
55177
|
-
*/
|
|
55362
|
+
/** @description 右上角关闭按钮,支持悬浮旋转动画 */
|
|
55178
55363
|
LibPixiCloseBtn,
|
|
55179
|
-
/** @description 底部弹出抽屉
|
|
55180
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDrawer-抽屉
|
|
55181
|
-
*/
|
|
55364
|
+
/** @description 底部弹出抽屉 */
|
|
55182
55365
|
LibPixiDrawer,
|
|
55183
|
-
/** @description 监视帧率、Draw Call、Max Draw Call
|
|
55184
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPerforMon-性能监视器
|
|
55185
|
-
*/
|
|
55366
|
+
/** @description 监视帧率、Draw Call、Max Draw Call */
|
|
55186
55367
|
LibPixiPerforMon,
|
|
55187
|
-
/** @description 通过裁剪的方式显示进度条
|
|
55188
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiProgress-进度条
|
|
55189
|
-
*/
|
|
55368
|
+
/** @description 通过裁剪的方式显示进度条 */
|
|
55190
55369
|
LibPixiProgress,
|
|
55191
|
-
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
55192
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X轴滚动容器
|
|
55193
|
-
*/
|
|
55370
|
+
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹 */
|
|
55194
55371
|
LibPixiScrollContainerX,
|
|
55195
|
-
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
55196
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y轴滚动容器
|
|
55197
|
-
*/
|
|
55372
|
+
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹 */
|
|
55198
55373
|
LibPixiScrollContainerY,
|
|
55199
|
-
/** @description 通过鼠标或手指拖动数字列选择数字
|
|
55200
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollNum-数字滑动
|
|
55201
|
-
*/
|
|
55374
|
+
/** @description 通过鼠标或手指拖动数字列选择数字 */
|
|
55202
55375
|
LibPixiScrollNum,
|
|
55203
|
-
/** @description 类似轮播图,但是不会自动轮播
|
|
55204
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSlider-横向滑动图
|
|
55205
|
-
*/
|
|
55376
|
+
/** @description 类似轮播图,但是不会自动轮播 */
|
|
55206
55377
|
LibPixiSlider,
|
|
55207
|
-
/** @description
|
|
55208
|
-
|
|
55209
|
-
|
|
55378
|
+
/** @description 滑动页 */
|
|
55379
|
+
LibPixiSlide,
|
|
55380
|
+
/** @description 最小、最大按钮和增减按钮功能及置灰逻辑 */
|
|
55210
55381
|
LibPixiSubAddMinMax,
|
|
55211
|
-
/** @description 绘制表格并填充数字
|
|
55212
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiTable-数字表格
|
|
55213
|
-
*/
|
|
55382
|
+
/** @description 绘制表格并填充数字 */
|
|
55214
55383
|
LibPixiTable
|
|
55215
55384
|
}
|
|
55216
55385
|
};
|
|
55217
55386
|
const Utils = {
|
|
55218
|
-
/** @description 音频播放器
|
|
55219
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiAudio-音频播放器
|
|
55220
|
-
*/
|
|
55387
|
+
/** @description 音频播放器 */
|
|
55221
55388
|
LibPixiAudio,
|
|
55222
|
-
/** @description 九宫格图
|
|
55223
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCreateNineGrid-九宫格图
|
|
55224
|
-
*/
|
|
55389
|
+
/** @description 九宫格图 */
|
|
55225
55390
|
libPixiCreateNineGrid,
|
|
55226
55391
|
/** @description 事件注册
|
|
55227
55392
|
* @param v 事件容器
|
|
55228
55393
|
* @param eventName 事件名称
|
|
55229
55394
|
* @param callback 回调函数
|
|
55230
|
-
* @param once 是否只执行一次
|
|
55231
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiEvent-事件注册
|
|
55232
|
-
*/
|
|
55395
|
+
* @param once 是否只执行一次 */
|
|
55233
55396
|
libPixiEvent,
|
|
55234
55397
|
/** @description 滤镜
|
|
55235
55398
|
* @param filterName 滤镜名称
|
|
55236
|
-
* @param v 滤镜值
|
|
55237
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiFilter-滤镜
|
|
55238
|
-
*/
|
|
55399
|
+
* @param v 滤镜值 */
|
|
55239
55400
|
libPixiFilter,
|
|
55240
55401
|
/** @description 间隔触发
|
|
55241
55402
|
* @param callback 回调函数
|
|
55242
|
-
* @param interval 间隔毫秒,或随机范围
|
|
55243
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiIntervalTrigger-间隔触发
|
|
55244
|
-
*/
|
|
55403
|
+
* @param interval 间隔毫秒,或随机范围 */
|
|
55245
55404
|
libPixiIntervalTrigger,
|
|
55246
55405
|
/** @description 点击容器外或入口按钮时隐藏
|
|
55247
55406
|
* @param container 容器
|
|
55248
55407
|
* @param btn 按钮
|
|
55249
|
-
* @param onClose 关闭回调
|
|
55250
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiOutsideClick-失焦隐藏
|
|
55251
|
-
*/
|
|
55408
|
+
* @param onClose 关闭回调 */
|
|
55252
55409
|
libPixiOutsideClick,
|
|
55253
55410
|
/** @description 为容器创建并应用一个矩形遮罩,用于隐藏溢出的内容,函数会返回遮罩,可控制是否显示遮罩
|
|
55254
|
-
* @param container 需要设置遮罩裁剪的容器
|
|
55255
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiOverflowHidden-溢出裁剪
|
|
55256
|
-
*/
|
|
55411
|
+
* @param container 需要设置遮罩裁剪的容器 */
|
|
55257
55412
|
libPixiOverflowHidden,
|
|
55258
55413
|
/** @description 基于 Ticker 和 Promise 的定时器
|
|
55259
55414
|
* @param delay 延迟时间
|
|
55260
|
-
* @param callback 延迟后执行的函数
|
|
55261
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPromiseTickerTimeout-TickerPromise定时器
|
|
55262
|
-
*/
|
|
55415
|
+
* @param callback 延迟后执行的函数 */
|
|
55263
55416
|
libPixiPromiseTickerTimeout,
|
|
55264
55417
|
/** @description 元素超过指定宽度就缩放
|
|
55265
55418
|
* @param scaleContainer 需要缩放的元素
|
|
55266
55419
|
* @param maxWidth 最大宽度
|
|
55267
|
-
* @param maxHeight 最大高度
|
|
55268
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScaleContainer-超出缩放
|
|
55269
|
-
*/
|
|
55420
|
+
* @param maxHeight 最大高度 */
|
|
55270
55421
|
libPixiScaleContainer,
|
|
55271
55422
|
/** @description 阴影
|
|
55272
55423
|
* @param container 需要添加阴影的元素
|
|
55273
|
-
* @param config 配置项
|
|
55274
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiShadow-阴影
|
|
55275
|
-
*/
|
|
55424
|
+
* @param config 配置项 */
|
|
55276
55425
|
libPixiShadow,
|
|
55277
55426
|
/** @description 基于 Ticker 的定时器
|
|
55278
55427
|
* @param callback 延迟后执行的函数
|
|
55279
|
-
* @param delay 延迟时间
|
|
55280
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiTickerTimeout-Ticker定时器
|
|
55281
|
-
*/
|
|
55428
|
+
* @param delay 延迟时间 */
|
|
55282
55429
|
libPixiTickerTimeout,
|
|
55283
|
-
/** @description 滑动选择器核心代码
|
|
55284
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSlideInput-滑动选择值
|
|
55285
|
-
*/
|
|
55430
|
+
/** @description 滑动选择器核心代码 */
|
|
55286
55431
|
LibPixiSlideInput,
|
|
55287
|
-
/** @description 事件总线更新实例汇总
|
|
55288
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibGlobalUpdater-事件实例汇总
|
|
55289
|
-
*/
|
|
55432
|
+
/** @description 事件总线更新实例汇总 */
|
|
55290
55433
|
LibPixiGlobalUpdater,
|
|
55291
|
-
/** @description 多边形绘制工具,绘制时浏览器窗口需要全屏显示,空格键控制开始和结束,开始后鼠标进行点击绘制,退格删除点,空格结束绘制,绘制结果在控制台打印,不满意可再次按空格清空并重新绘制
|
|
55292
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygonDrawTool-多边形绘制
|
|
55293
|
-
*/
|
|
55434
|
+
/** @description 多边形绘制工具,绘制时浏览器窗口需要全屏显示,空格键控制开始和结束,开始后鼠标进行点击绘制,退格删除点,空格结束绘制,绘制结果在控制台打印,不满意可再次按空格清空并重新绘制 */
|
|
55294
55435
|
LibPixiPolygonDrawTool,
|
|
55295
55436
|
/** @description 数值递增动画
|
|
55296
55437
|
* @param params 动画参数
|
|
55297
|
-
* @returns 设置为目标值并停止动画
|
|
55298
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
|
|
55299
|
-
*/
|
|
55438
|
+
* @returns 设置为目标值并停止动画 */
|
|
55300
55439
|
LibPixiDigitalIncreasingAnimation,
|
|
55301
55440
|
/** @description 按下放大
|
|
55302
|
-
* @param container 要放大的容器
|
|
55303
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
|
|
55304
|
-
*/
|
|
55441
|
+
* @param container 要放大的容器 */
|
|
55305
55442
|
LibPixiDownScaleAnimation,
|
|
55306
55443
|
/**
|
|
55307
55444
|
* @description 将元素按照指定的列数和间隔排列成网格布局。
|
|
55308
55445
|
* @param items 要排列的元素数组
|
|
55309
55446
|
* @param gap 每个元素之间的间隔
|
|
55310
|
-
* @param cols 网格的列数,默认为元素数量
|
|
55311
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
|
|
55312
|
-
*/
|
|
55447
|
+
* @param cols 网格的列数,默认为元素数量 */
|
|
55313
55448
|
LibPixiGridLayout
|
|
55314
55449
|
};
|
|
55315
55450
|
const LibPixiJs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|