lyb-pixi-js 1.7.3 → 1.7.4
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/Custom/LibPixiScrollContainerX.d.ts +1 -3
- package/Components/Custom/LibPixiScrollContainerX.js +3 -9
- package/Components/Custom/LibPixiScrollContainerY.d.ts +1 -1
- package/Components/Custom/LibPixiScrollContainerY.js +3 -9
- package/README.md +0 -2
- package/lyb-pixi.js +83 -109
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Container } from "pixi.js";
|
|
2
|
-
import { LibPixiContainer } from
|
|
2
|
+
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
3
3
|
export interface LibPixiScrollContainerXParams {
|
|
4
4
|
/** 宽度 */
|
|
5
5
|
width: number;
|
|
@@ -7,8 +7,6 @@ export interface LibPixiScrollContainerXParams {
|
|
|
7
7
|
height: number;
|
|
8
8
|
/** 滚动内容 */
|
|
9
9
|
scrollContent: Container;
|
|
10
|
-
/** 底部内边距 */
|
|
11
|
-
bottomMargin?: number;
|
|
12
10
|
}
|
|
13
11
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
14
12
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X轴滚动容器
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Container, Graphics
|
|
1
|
+
import { Container, Graphics } from "pixi.js";
|
|
2
2
|
import { gsap } from "gsap";
|
|
3
|
-
import { LibPixiContainer } from
|
|
3
|
+
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
4
4
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
5
5
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X轴滚动容器
|
|
6
6
|
*/
|
|
7
7
|
export class LibPixiScrollContainerX extends LibPixiContainer {
|
|
8
8
|
constructor(params) {
|
|
9
|
-
const { width, height, scrollContent
|
|
9
|
+
const { width, height, scrollContent } = params;
|
|
10
10
|
super(width, height);
|
|
11
11
|
/** 开始位置 */
|
|
12
12
|
this._startX = 0;
|
|
@@ -25,12 +25,6 @@ export class LibPixiScrollContainerX extends LibPixiContainer {
|
|
|
25
25
|
this._content = new Container();
|
|
26
26
|
this.addChild(this._content);
|
|
27
27
|
this._content.addChild(this._scrollContent);
|
|
28
|
-
// 创建底部占位
|
|
29
|
-
if (bottomMargin > 0) {
|
|
30
|
-
const bottom_box = new Sprite();
|
|
31
|
-
this._content.addChild(bottom_box);
|
|
32
|
-
bottom_box.x = this._content.width + bottomMargin;
|
|
33
|
-
}
|
|
34
28
|
// 创建遮罩
|
|
35
29
|
this._maskGraphics = new Graphics();
|
|
36
30
|
this.addChild(this._maskGraphics);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Container, Graphics
|
|
1
|
+
import { Container, Graphics } from "pixi.js";
|
|
2
2
|
import { gsap } from "gsap";
|
|
3
|
-
import { LibPixiContainer } from
|
|
3
|
+
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
4
4
|
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
5
5
|
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y轴滚动容器
|
|
6
6
|
*/
|
|
7
7
|
export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
8
8
|
constructor(params) {
|
|
9
|
-
const { width, height, scrollContent
|
|
9
|
+
const { width, height, scrollContent } = params;
|
|
10
10
|
super(width, height);
|
|
11
11
|
/** 开始位置 */
|
|
12
12
|
this._startY = 0;
|
|
@@ -25,12 +25,6 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
|
25
25
|
this._content = new Container();
|
|
26
26
|
this.addChild(this._content);
|
|
27
27
|
this._content.addChild(this._scrollContent);
|
|
28
|
-
// 创建底部占位
|
|
29
|
-
if (bottomMargin > 0) {
|
|
30
|
-
const bottom_box = new Sprite();
|
|
31
|
-
this._content.addChild(bottom_box);
|
|
32
|
-
bottom_box.y = this._content.height + bottomMargin;
|
|
33
|
-
}
|
|
34
28
|
// 创建遮罩
|
|
35
29
|
this._maskGraphics = new Graphics();
|
|
36
30
|
this.addChild(this._maskGraphics);
|
package/README.md
CHANGED
|
@@ -597,7 +597,6 @@ const scrollContainer = new LibPixiScrollContainerX({
|
|
|
597
597
|
width: 800,
|
|
598
598
|
height: 600,
|
|
599
599
|
scrollContent: scrollContent,
|
|
600
|
-
bottomMargin: 50, //可选:底部内边距
|
|
601
600
|
});
|
|
602
601
|
|
|
603
602
|
//添加到Pixi.js场景
|
|
@@ -628,7 +627,6 @@ const scrollContainer = new LibPixiScrollContainerY({
|
|
|
628
627
|
width: 800,
|
|
629
628
|
height: 600,
|
|
630
629
|
scrollContent: scrollContent,
|
|
631
|
-
bottomMargin: 50, //可选:底部内边距
|
|
632
630
|
});
|
|
633
631
|
|
|
634
632
|
//添加到Pixi.js场景
|
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,93 +1833,77 @@
|
|
|
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
|
-
|
|
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;
|
|
1923
1907
|
var functionCall;
|
|
1924
1908
|
var hasRequiredFunctionCall;
|
|
1925
1909
|
function requireFunctionCall() {
|
|
@@ -1939,12 +1923,12 @@
|
|
|
1939
1923
|
return functionApply;
|
|
1940
1924
|
}
|
|
1941
1925
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
1942
|
-
var bind$2 =
|
|
1926
|
+
var bind$2 = functionBind;
|
|
1943
1927
|
var $apply$1 = requireFunctionApply();
|
|
1944
1928
|
var $call$2 = requireFunctionCall();
|
|
1945
1929
|
var $reflectApply = reflectApply;
|
|
1946
1930
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
1947
|
-
var bind$1 =
|
|
1931
|
+
var bind$1 = functionBind;
|
|
1948
1932
|
var $TypeError$4 = type;
|
|
1949
1933
|
var $call$1 = requireFunctionCall();
|
|
1950
1934
|
var $actualApply = actualApply;
|
|
@@ -2015,7 +1999,7 @@
|
|
|
2015
1999
|
hasRequiredHasown = 1;
|
|
2016
2000
|
var call = Function.prototype.call;
|
|
2017
2001
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
2018
|
-
var bind2 =
|
|
2002
|
+
var bind2 = functionBind;
|
|
2019
2003
|
hasown = bind2.call(call, $hasOwn);
|
|
2020
2004
|
return hasown;
|
|
2021
2005
|
}
|
|
@@ -2030,7 +2014,7 @@
|
|
|
2030
2014
|
var $URIError = uri;
|
|
2031
2015
|
var abs = abs$1;
|
|
2032
2016
|
var floor = floor$1;
|
|
2033
|
-
var max = max$
|
|
2017
|
+
var max = max$2;
|
|
2034
2018
|
var min = min$1;
|
|
2035
2019
|
var pow = pow$1;
|
|
2036
2020
|
var round$1 = round$2;
|
|
@@ -2234,7 +2218,7 @@
|
|
|
2234
2218
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
2235
2219
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
2236
2220
|
};
|
|
2237
|
-
var bind =
|
|
2221
|
+
var bind = functionBind;
|
|
2238
2222
|
var hasOwn = requireHasown();
|
|
2239
2223
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
2240
2224
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
@@ -49116,7 +49100,7 @@ void main(void)\r
|
|
|
49116
49100
|
}
|
|
49117
49101
|
class LibPixiScrollContainerX extends LibPixiContainer {
|
|
49118
49102
|
constructor(params) {
|
|
49119
|
-
const { width, height, scrollContent
|
|
49103
|
+
const { width, height, scrollContent } = params;
|
|
49120
49104
|
super(width, height);
|
|
49121
49105
|
this._startX = 0;
|
|
49122
49106
|
this._velocity = 0;
|
|
@@ -49128,11 +49112,6 @@ void main(void)\r
|
|
|
49128
49112
|
this._content = new Container();
|
|
49129
49113
|
this.addChild(this._content);
|
|
49130
49114
|
this._content.addChild(this._scrollContent);
|
|
49131
|
-
if (bottomMargin > 0) {
|
|
49132
|
-
const bottom_box = new Sprite();
|
|
49133
|
-
this._content.addChild(bottom_box);
|
|
49134
|
-
bottom_box.x = this._content.width + bottomMargin;
|
|
49135
|
-
}
|
|
49136
49115
|
this._maskGraphics = new Graphics();
|
|
49137
49116
|
this.addChild(this._maskGraphics);
|
|
49138
49117
|
this._maskGraphics.clear();
|
|
@@ -49252,7 +49231,7 @@ void main(void)\r
|
|
|
49252
49231
|
}
|
|
49253
49232
|
class LibPixiScrollContainerY extends LibPixiContainer {
|
|
49254
49233
|
constructor(params) {
|
|
49255
|
-
const { width, height, scrollContent
|
|
49234
|
+
const { width, height, scrollContent } = params;
|
|
49256
49235
|
super(width, height);
|
|
49257
49236
|
this._startY = 0;
|
|
49258
49237
|
this._velocity = 0;
|
|
@@ -49264,11 +49243,6 @@ void main(void)\r
|
|
|
49264
49243
|
this._content = new Container();
|
|
49265
49244
|
this.addChild(this._content);
|
|
49266
49245
|
this._content.addChild(this._scrollContent);
|
|
49267
|
-
if (bottomMargin > 0) {
|
|
49268
|
-
const bottom_box = new Sprite();
|
|
49269
|
-
this._content.addChild(bottom_box);
|
|
49270
|
-
bottom_box.y = this._content.height + bottomMargin;
|
|
49271
|
-
}
|
|
49272
49246
|
this._maskGraphics = new Graphics();
|
|
49273
49247
|
this.addChild(this._maskGraphics);
|
|
49274
49248
|
this._maskGraphics.clear();
|