lyb-pixi-js 1.9.1 → 1.9.3

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.
@@ -15,6 +15,8 @@ export interface LibPixiScrollContainerYParams {
15
15
  scrollbarWidth?: number;
16
16
  /** 滚动条颜色 */
17
17
  scrollbarColor?: string;
18
+ /** 滚动触发 */
19
+ onScroll?: (y: number) => void;
18
20
  }
19
21
  /** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
20
22
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y 轴滚动容器
@@ -46,6 +48,8 @@ export declare class LibPixiScrollContainerY extends LibPixiContainer {
46
48
  private _scrollbar;
47
49
  /** 滚动条颜色 */
48
50
  private _scrollbarColor;
51
+ /** 滚动触发 */
52
+ private _onScroll?;
49
53
  constructor(params: LibPixiScrollContainerYParams);
50
54
  /** @description 设置滚动容器可视区宽高
51
55
  * @param width 宽度
@@ -1,14 +1,14 @@
1
1
  import { Container } from "pixi.js";
2
2
  import { gsap } from "gsap";
3
- import { LibPixiRectangle } from "../Base/LibPixiRectangle";
4
3
  import { libPixiEvent } from "../../Utils/LibPixiEvent";
5
4
  import { LibPixiContainer } from "../Base/LibPixiContainer";
5
+ import { LibPixiRectangle } from "../Base/LibPixiRectangle";
6
6
  /** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
7
7
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y 轴滚动容器
8
8
  */
9
9
  export class LibPixiScrollContainerY extends LibPixiContainer {
10
10
  constructor(params) {
11
- const { width, height, scrollbar = false, scrollContent, scrollbarRgiht, scrollbarWidth = 10, scrollbarColor = "#ffffff", } = params;
11
+ const { width, height, scrollbar = false, scrollContent, scrollbarRgiht, scrollbarWidth = 10, scrollbarColor = "#ffffff", onScroll, } = params;
12
12
  super(width, height);
13
13
  /** 开始位置 */
14
14
  this._startY = 0;
@@ -28,6 +28,7 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
28
28
  this._scrollbarDragOffset = 0;
29
29
  this._scrollContent = scrollContent;
30
30
  this._scrollbarColor = scrollbarColor;
31
+ this._onScroll = onScroll;
31
32
  // 创建内容容器
32
33
  this._content = new Container();
33
34
  this.addChild(this._content);
@@ -237,6 +238,7 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
237
238
  }
238
239
  /** @description 更新滚动位置 */
239
240
  _updateScrollbar() {
241
+ var _a;
240
242
  this._scrollbar.alpha = 1;
241
243
  gsap.killTweensOf(this._scrollbar);
242
244
  const viewHeight = this._maskGraphics.height;
@@ -247,6 +249,7 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
247
249
  const scrollY = Math.min(Math.max(-this._content.y, 0), maxScrollY);
248
250
  const barY = (scrollY / maxScrollY) * (viewHeight - barHeight);
249
251
  this._scrollbar.y = barY;
252
+ (_a = this._onScroll) === null || _a === void 0 ? void 0 : _a.call(this, this._content.y);
250
253
  }
251
254
  /** @description 更新滚动条大小 */
252
255
  _updateScrollbarSize() {
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$1 = Math.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 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];
1850
- }
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;
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
- return str;
1872
- };
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,
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
- 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;
1880
+ if (Object(result) === result) {
1881
+ return result;
1882
+ }
1883
+ return this;
1908
1884
  }
1909
- return bound;
1885
+ return target.apply(
1886
+ that,
1887
+ concatty(args, arguments)
1888
+ );
1910
1889
  };
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
- }
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 = requireFunctionBind();
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 = requireFunctionBind();
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 = requireFunctionBind();
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$1;
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 = requireFunctionBind();
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);
@@ -49265,7 +49249,8 @@ void main(void)\r
49265
49249
  scrollContent,
49266
49250
  scrollbarRgiht,
49267
49251
  scrollbarWidth = 10,
49268
- scrollbarColor = "#ffffff"
49252
+ scrollbarColor = "#ffffff",
49253
+ onScroll
49269
49254
  } = params;
49270
49255
  super(width, height);
49271
49256
  this._startY = 0;
@@ -49278,6 +49263,7 @@ void main(void)\r
49278
49263
  this._scrollbarDragOffset = 0;
49279
49264
  this._scrollContent = scrollContent;
49280
49265
  this._scrollbarColor = scrollbarColor;
49266
+ this._onScroll = onScroll;
49281
49267
  this._content = new Container();
49282
49268
  this.addChild(this._content);
49283
49269
  this._content.addChild(this._scrollContent);
@@ -49475,6 +49461,7 @@ void main(void)\r
49475
49461
  }
49476
49462
  /** @description 更新滚动位置 */
49477
49463
  _updateScrollbar() {
49464
+ var _a;
49478
49465
  this._scrollbar.alpha = 1;
49479
49466
  gsapWithCSS.killTweensOf(this._scrollbar);
49480
49467
  const viewHeight = this._maskGraphics.height;
@@ -49485,6 +49472,7 @@ void main(void)\r
49485
49472
  const scrollY = Math.min(Math.max(-this._content.y, 0), maxScrollY);
49486
49473
  const barY = scrollY / maxScrollY * (viewHeight - barHeight);
49487
49474
  this._scrollbar.y = barY;
49475
+ (_a = this._onScroll) == null ? void 0 : _a.call(this, this._content.y);
49488
49476
  }
49489
49477
  /** @description 更新滚动条大小 */
49490
49478
  _updateScrollbarSize() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {