lyb-pixi-js 1.12.8 → 1.12.10
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/LibPixiScrollContainerY.js +6 -0
- package/README.md +5 -0
- package/Utils/LibPixiTicker.d.ts +14 -0
- package/Utils/LibPixiTicker.js +50 -0
- package/libPixiJs.d.ts +3 -0
- package/libPixiJs.js +3 -0
- package/lyb-pixi.js +54 -1
- package/package.json +1 -1
|
@@ -261,6 +261,12 @@ export class LibPixiScrollContainerY extends LibPixiContainer {
|
|
|
261
261
|
_updateScrollbarSize() {
|
|
262
262
|
const viewHeight = this._maskGraphics.height;
|
|
263
263
|
const contentHeight = this._content.height;
|
|
264
|
+
if (contentHeight <= viewHeight) {
|
|
265
|
+
this._scrollbar.visible = false;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this._scrollbar.visible = true;
|
|
269
|
+
}
|
|
264
270
|
const ratio = viewHeight / contentHeight;
|
|
265
271
|
const barHeight = viewHeight * ratio;
|
|
266
272
|
this._scrollbar.clear();
|
package/README.md
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @description Ticker管理器 */
|
|
2
|
+
export declare class LibPixiTicker {
|
|
3
|
+
private static _callbacks;
|
|
4
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
5
|
+
static add(id: string, fn: () => void): () => void;
|
|
6
|
+
/** @description 删除回调 */
|
|
7
|
+
static remove(id: string): void;
|
|
8
|
+
/** @description 停止某个回调(pause) */
|
|
9
|
+
static stop(id: string): void;
|
|
10
|
+
/** @description 启动某个回调(resume) */
|
|
11
|
+
static start(id: string): void;
|
|
12
|
+
/** @description 清空所有回调 */
|
|
13
|
+
static clearAll(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Ticker } from "pixi.js";
|
|
2
|
+
/** @description Ticker管理器 */
|
|
3
|
+
export class LibPixiTicker {
|
|
4
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
5
|
+
static add(id, fn) {
|
|
6
|
+
// 如果已有相同 ID,先移除旧回调
|
|
7
|
+
if (this._callbacks.has(id)) {
|
|
8
|
+
Ticker.shared.remove(this._callbacks.get(id).fn);
|
|
9
|
+
}
|
|
10
|
+
// 默认 active
|
|
11
|
+
this._callbacks.set(id, { fn, active: true });
|
|
12
|
+
Ticker.shared.add(fn);
|
|
13
|
+
return () => {
|
|
14
|
+
Ticker.shared.remove(fn);
|
|
15
|
+
this._callbacks.delete(id);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** @description 删除回调 */
|
|
19
|
+
static remove(id) {
|
|
20
|
+
const cb = this._callbacks.get(id);
|
|
21
|
+
if (cb) {
|
|
22
|
+
Ticker.shared.remove(cb.fn);
|
|
23
|
+
this._callbacks.delete(id);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** @description 停止某个回调(pause) */
|
|
27
|
+
static stop(id) {
|
|
28
|
+
const cb = this._callbacks.get(id);
|
|
29
|
+
if (cb && cb.active) {
|
|
30
|
+
Ticker.shared.remove(cb.fn);
|
|
31
|
+
cb.active = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** @description 启动某个回调(resume) */
|
|
35
|
+
static start(id) {
|
|
36
|
+
const cb = this._callbacks.get(id);
|
|
37
|
+
if (cb && !cb.active) {
|
|
38
|
+
Ticker.shared.add(cb.fn);
|
|
39
|
+
cb.active = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** @description 清空所有回调 */
|
|
43
|
+
static clearAll() {
|
|
44
|
+
this._callbacks.forEach((cb) => {
|
|
45
|
+
Ticker.shared.remove(cb.fn);
|
|
46
|
+
});
|
|
47
|
+
this._callbacks.clear();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
LibPixiTicker._callbacks = new Map();
|
package/libPixiJs.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ import { LibPixiRound } from "./Components/Base/LibPixiRound";
|
|
|
34
34
|
import { LibPixiRoundedRect } from "./Components/Base/LibPixiRoundedRect";
|
|
35
35
|
import { LibPixiInput } from "./Components/Custom/LibPixiInput";
|
|
36
36
|
import { LibPixiGridLayoutV2 } from "./Utils/LibPixiGridLayoutV2";
|
|
37
|
+
import { LibPixiTicker } from "./Utils/LibPixiTicker";
|
|
37
38
|
/** @description 组件 */
|
|
38
39
|
export declare const Components: {
|
|
39
40
|
Base: {
|
|
@@ -284,4 +285,6 @@ export declare const Utils: {
|
|
|
284
285
|
* @param payload 事件携带数据
|
|
285
286
|
*/
|
|
286
287
|
LibPixiEmitContainerEvent: (container: import("pixi.js").Container, event: string, payload?: any) => void;
|
|
288
|
+
/** @description Ticker管理器 */
|
|
289
|
+
LibPixiTicker: typeof LibPixiTicker;
|
|
287
290
|
};
|
package/libPixiJs.js
CHANGED
|
@@ -53,6 +53,7 @@ import { LibPixiRound } from "./Components/Base/LibPixiRound";
|
|
|
53
53
|
import { LibPixiRoundedRect } from "./Components/Base/LibPixiRoundedRect";
|
|
54
54
|
import { LibPixiInput } from "./Components/Custom/LibPixiInput";
|
|
55
55
|
import { LibPixiGridLayoutV2 } from "./Utils/LibPixiGridLayoutV2";
|
|
56
|
+
import { LibPixiTicker } from "./Utils/LibPixiTicker";
|
|
56
57
|
/** @description 组件 */
|
|
57
58
|
export const Components = {
|
|
58
59
|
Base: {
|
|
@@ -303,4 +304,6 @@ export const Utils = {
|
|
|
303
304
|
* @param payload 事件携带数据
|
|
304
305
|
*/
|
|
305
306
|
LibPixiEmitContainerEvent,
|
|
307
|
+
/** @description Ticker管理器 */
|
|
308
|
+
LibPixiTicker,
|
|
306
309
|
};
|
package/lyb-pixi.js
CHANGED
|
@@ -49569,6 +49569,11 @@ void main(void)\r
|
|
|
49569
49569
|
_updateScrollbarSize() {
|
|
49570
49570
|
const viewHeight = this._maskGraphics.height;
|
|
49571
49571
|
const contentHeight = this._content.height;
|
|
49572
|
+
if (contentHeight <= viewHeight) {
|
|
49573
|
+
this._scrollbar.visible = false;
|
|
49574
|
+
} else {
|
|
49575
|
+
this._scrollbar.visible = true;
|
|
49576
|
+
}
|
|
49572
49577
|
const ratio = viewHeight / contentHeight;
|
|
49573
49578
|
const barHeight = viewHeight * ratio;
|
|
49574
49579
|
this._scrollbar.clear();
|
|
@@ -58336,6 +58341,52 @@ void main(void){
|
|
|
58336
58341
|
this._elementList = [];
|
|
58337
58342
|
}
|
|
58338
58343
|
}
|
|
58344
|
+
class LibPixiTicker {
|
|
58345
|
+
/** @description 添加回调,重复 ID 会覆盖 */
|
|
58346
|
+
static add(id2, fn) {
|
|
58347
|
+
if (this._callbacks.has(id2)) {
|
|
58348
|
+
Ticker.shared.remove(this._callbacks.get(id2).fn);
|
|
58349
|
+
}
|
|
58350
|
+
this._callbacks.set(id2, { fn, active: true });
|
|
58351
|
+
Ticker.shared.add(fn);
|
|
58352
|
+
return () => {
|
|
58353
|
+
Ticker.shared.remove(fn);
|
|
58354
|
+
this._callbacks.delete(id2);
|
|
58355
|
+
};
|
|
58356
|
+
}
|
|
58357
|
+
/** @description 删除回调 */
|
|
58358
|
+
static remove(id2) {
|
|
58359
|
+
const cb = this._callbacks.get(id2);
|
|
58360
|
+
if (cb) {
|
|
58361
|
+
Ticker.shared.remove(cb.fn);
|
|
58362
|
+
this._callbacks.delete(id2);
|
|
58363
|
+
}
|
|
58364
|
+
}
|
|
58365
|
+
/** @description 停止某个回调(pause) */
|
|
58366
|
+
static stop(id2) {
|
|
58367
|
+
const cb = this._callbacks.get(id2);
|
|
58368
|
+
if (cb && cb.active) {
|
|
58369
|
+
Ticker.shared.remove(cb.fn);
|
|
58370
|
+
cb.active = false;
|
|
58371
|
+
}
|
|
58372
|
+
}
|
|
58373
|
+
/** @description 启动某个回调(resume) */
|
|
58374
|
+
static start(id2) {
|
|
58375
|
+
const cb = this._callbacks.get(id2);
|
|
58376
|
+
if (cb && !cb.active) {
|
|
58377
|
+
Ticker.shared.add(cb.fn);
|
|
58378
|
+
cb.active = true;
|
|
58379
|
+
}
|
|
58380
|
+
}
|
|
58381
|
+
/** @description 清空所有回调 */
|
|
58382
|
+
static clearAll() {
|
|
58383
|
+
this._callbacks.forEach((cb) => {
|
|
58384
|
+
Ticker.shared.remove(cb.fn);
|
|
58385
|
+
});
|
|
58386
|
+
this._callbacks.clear();
|
|
58387
|
+
}
|
|
58388
|
+
}
|
|
58389
|
+
LibPixiTicker._callbacks = /* @__PURE__ */ new Map();
|
|
58339
58390
|
const Components = {
|
|
58340
58391
|
Base: {
|
|
58341
58392
|
/** (已废弃)
|
|
@@ -58583,7 +58634,9 @@ void main(void){
|
|
|
58583
58634
|
* @param event 事件名称
|
|
58584
58635
|
* @param payload 事件携带数据
|
|
58585
58636
|
*/
|
|
58586
|
-
LibPixiEmitContainerEvent
|
|
58637
|
+
LibPixiEmitContainerEvent,
|
|
58638
|
+
/** @description Ticker管理器 */
|
|
58639
|
+
LibPixiTicker
|
|
58587
58640
|
};
|
|
58588
58641
|
const LibPixiJs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
58589
58642
|
__proto__: null,
|