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.
|
@@ -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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
49384
|
-
|
|
49385
|
-
|
|
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;
|