1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | var color = require('@pixi/color');
|
6 | var extensions = require('@pixi/extensions');
|
7 |
|
8 | class BackgroundSystem {
|
9 | constructor() {
|
10 | this.clearBeforeRender = true;
|
11 | this._backgroundColor = new color.Color(0);
|
12 | this.alpha = 1;
|
13 | }
|
14 | init(options) {
|
15 | this.clearBeforeRender = options.clearBeforeRender;
|
16 | const { backgroundColor, background, backgroundAlpha } = options;
|
17 | const color = background ?? backgroundColor;
|
18 | if (color !== void 0) {
|
19 | this.color = color;
|
20 | }
|
21 | this.alpha = backgroundAlpha;
|
22 | }
|
23 | get color() {
|
24 | return this._backgroundColor.value;
|
25 | }
|
26 | set color(value) {
|
27 | this._backgroundColor.setValue(value);
|
28 | }
|
29 | get alpha() {
|
30 | return this._backgroundColor.alpha;
|
31 | }
|
32 | set alpha(value) {
|
33 | this._backgroundColor.setAlpha(value);
|
34 | }
|
35 | get backgroundColor() {
|
36 | return this._backgroundColor;
|
37 | }
|
38 | destroy() {
|
39 | }
|
40 | }
|
41 | BackgroundSystem.defaultOptions = {
|
42 | backgroundAlpha: 1,
|
43 | backgroundColor: 0,
|
44 | clearBeforeRender: true
|
45 | };
|
46 | BackgroundSystem.extension = {
|
47 | type: [
|
48 | extensions.ExtensionType.RendererSystem,
|
49 | extensions.ExtensionType.CanvasRendererSystem
|
50 | ],
|
51 | name: "background"
|
52 | };
|
53 | extensions.extensions.add(BackgroundSystem);
|
54 |
|
55 | exports.BackgroundSystem = BackgroundSystem;
|
56 |
|