lyb-pixi-js 1.12.14 → 1.12.15

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.
@@ -7,6 +7,8 @@ export interface LibPixiScrollContainerYParams {
7
7
  height: number;
8
8
  /** 滚动内容 */
9
9
  scrollContent: Container;
10
+ /** 顶部边距 */
11
+ topMargin?: number;
10
12
  /** 底部边距 */
11
13
  bottomMargin?: number;
12
14
  /** 背景色,用于定位 */
@@ -8,7 +8,7 @@ import { LibPixiRectangle } from "../Base/LibPixiRectangle";
8
8
  */
9
9
  export class LibPixiScrollContainerY extends LibPixiContainer {
10
10
  constructor(params) {
11
- const { width, height, scrollbar = false, scrollContent, scrollbarRgiht = 0, scrollbarWidth = 10, scrollbarColor = "#ffffff", onScroll, bgColor, bottomMargin = 0, } = params;
11
+ const { width, height, scrollbar = false, scrollContent, scrollbarRgiht = 0, scrollbarWidth = 10, scrollbarColor = "#ffffff", onScroll, bgColor, topMargin = 0, bottomMargin = 0, } = params;
12
12
  super(width, height, bgColor);
13
13
  /** 开始位置 */
14
14
  this._startY = 0;
@@ -36,10 +36,24 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
36
36
  this._content = new Container();
37
37
  this.addChild(this._content);
38
38
  this._content.addChild(this._scrollContent);
39
- //创建底部边距
40
- const bottomMarginBox = new Sprite();
41
- this._content.addChild(bottomMarginBox);
42
- bottomMarginBox.height = this._content.height + bottomMargin;
39
+ if (topMargin) {
40
+ //创建底部边距
41
+ const topMarginBox = new Sprite();
42
+ this._content.addChild(topMarginBox);
43
+ topMarginBox.height = topMargin;
44
+ requestAnimationFrame(() => {
45
+ this._scrollContent.y += topMargin;
46
+ });
47
+ }
48
+ if (bottomMargin) {
49
+ //创建底部边距
50
+ const bottomMarginBox = new Sprite();
51
+ this._content.addChild(bottomMarginBox);
52
+ bottomMarginBox.height = bottomMargin;
53
+ requestAnimationFrame(() => {
54
+ bottomMarginBox.y = topMargin + this._scrollContent.height;
55
+ });
56
+ }
43
57
  // 创建遮罩
44
58
  this._maskGraphics = new LibPixiRectangle(width, height, "#000");
45
59
  this.addChild(this._maskGraphics);
package/lyb-pixi.js CHANGED
@@ -49360,6 +49360,7 @@ void main(void)\r
49360
49360
  scrollbarColor = "#ffffff",
49361
49361
  onScroll,
49362
49362
  bgColor,
49363
+ topMargin = 0,
49363
49364
  bottomMargin = 0
49364
49365
  } = params;
49365
49366
  super(width, height, bgColor);
@@ -49380,9 +49381,22 @@ void main(void)\r
49380
49381
  this._content = new Container();
49381
49382
  this.addChild(this._content);
49382
49383
  this._content.addChild(this._scrollContent);
49383
- const bottomMarginBox = new Sprite();
49384
- this._content.addChild(bottomMarginBox);
49385
- bottomMarginBox.height = this._content.height + bottomMargin;
49384
+ if (topMargin) {
49385
+ const topMarginBox = new Sprite();
49386
+ this._content.addChild(topMarginBox);
49387
+ topMarginBox.height = topMargin;
49388
+ requestAnimationFrame(() => {
49389
+ this._scrollContent.y += topMargin;
49390
+ });
49391
+ }
49392
+ if (bottomMargin) {
49393
+ const bottomMarginBox = new Sprite();
49394
+ this._content.addChild(bottomMarginBox);
49395
+ bottomMarginBox.height = bottomMargin;
49396
+ requestAnimationFrame(() => {
49397
+ bottomMarginBox.y = topMargin + this._scrollContent.height;
49398
+ });
49399
+ }
49386
49400
  this._maskGraphics = new LibPixiRectangle(width, height, "#000");
49387
49401
  this.addChild(this._maskGraphics);
49388
49402
  this.mask = this._maskGraphics;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.12.14",
3
+ "version": "1.12.15",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {