pixifact 0.1.3 → 0.1.5
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/README.md +3 -3
- package/dist/builtin-scenes/CenterContainer.d.ts +13 -0
- package/dist/builtin-scenes/CenterContainer.js +71 -0
- package/dist/builtin-scenes/CenterContainer.scene +3 -0
- package/dist/builtin-scenes/CenterContainer.ts +77 -0
- package/dist/builtin-scenes/Control.d.ts +44 -0
- package/dist/builtin-scenes/Control.js +206 -0
- package/dist/builtin-scenes/Control.scene +3 -0
- package/dist/builtin-scenes/Control.ts +233 -0
- package/dist/builtin-scenes/FlexItem.d.ts +45 -0
- package/dist/builtin-scenes/FlexItem.js +164 -0
- package/dist/builtin-scenes/FlexItem.scene +3 -0
- package/dist/builtin-scenes/FlexItem.ts +180 -0
- package/dist/builtin-scenes/FlexLayout.d.ts +29 -0
- package/dist/builtin-scenes/FlexLayout.js +358 -0
- package/dist/builtin-scenes/FlexLayout.scene +3 -0
- package/dist/builtin-scenes/FlexLayout.ts +409 -0
- package/dist/builtin-scenes/HBoxContainer.d.ts +15 -0
- package/dist/builtin-scenes/HBoxContainer.js +70 -0
- package/dist/builtin-scenes/HBoxContainer.scene +3 -0
- package/dist/builtin-scenes/HBoxContainer.ts +75 -0
- package/dist/builtin-scenes/MarginContainer.d.ts +23 -0
- package/dist/builtin-scenes/MarginContainer.js +131 -0
- package/dist/builtin-scenes/MarginContainer.scene +3 -0
- package/dist/builtin-scenes/MarginContainer.ts +139 -0
- package/dist/builtin-scenes/VBoxContainer.d.ts +15 -0
- package/dist/builtin-scenes/VBoxContainer.js +70 -0
- package/dist/builtin-scenes/VBoxContainer.scene +3 -0
- package/dist/builtin-scenes/VBoxContainer.ts +75 -0
- package/dist/builtin-scenes/controlLayout.d.ts +57 -0
- package/dist/builtin-scenes/controlLayout.js +202 -0
- package/dist/builtin-scenes/controlLayout.ts +270 -0
- package/dist/compiler/builtinScenes.d.ts +14 -0
- package/dist/compiler/builtinScenes.js +62 -0
- package/dist/compiler/compileScenes.js +126 -19
- package/dist/compiler/decorators.js +3 -0
- package/dist/compiler/index.d.ts +1 -0
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/sceneAssetPair.js +19 -0
- package/dist/compiler/sceneRuntime.d.ts +5 -4
- package/dist/compiler/scriptInterfaceExtractor.d.ts +5 -0
- package/dist/compiler/scriptInterfaceExtractor.js +214 -8
- package/dist/compiler/spec.d.ts +2 -0
- package/dist/compiler/templateParser.js +4 -3
- package/dist/compiler/templateSerializer.js +2 -1
- package/dist/compiler/typescriptCompiler.js +87 -13
- package/dist/compiler-node/builtinSceneAssets.d.ts +8 -0
- package/dist/compiler-node/builtinSceneAssets.js +57 -0
- package/dist/compiler-node/index.d.ts +1 -0
- package/dist/compiler-node/index.js +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +24 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.js +2 -5
- package/dist/{authoring/ProjectConfig.d.ts → project/index.d.ts} +7 -0
- package/dist/{authoring/ProjectConfig.js → project/index.js} +22 -0
- package/dist/runtime/Group.d.ts +18 -0
- package/dist/runtime/Group.js +45 -0
- package/dist/runtime/index.d.ts +1 -9
- package/dist/runtime/index.js +1 -9
- package/package.json +4 -26
- package/dist/authoring/ActionRegistry.d.ts +0 -10
- package/dist/authoring/ActionRegistry.js +0 -26
- package/dist/authoring/ComponentPalette.d.ts +0 -16
- package/dist/authoring/ComponentPalette.js +0 -50
- package/dist/authoring/DesignToken.d.ts +0 -16
- package/dist/authoring/DesignToken.js +0 -33
- package/dist/authoring/DiffModel.d.ts +0 -10
- package/dist/authoring/DiffModel.js +0 -104
- package/dist/authoring/InspectorModel.d.ts +0 -27
- package/dist/authoring/InspectorModel.js +0 -139
- package/dist/authoring/LogicGraph.d.ts +0 -66
- package/dist/authoring/LogicGraph.js +0 -184
- package/dist/authoring/OverrideJournal.d.ts +0 -18
- package/dist/authoring/OverrideJournal.js +0 -23
- package/dist/authoring/PreferenceMemory.d.ts +0 -21
- package/dist/authoring/PreferenceMemory.js +0 -39
- package/dist/authoring/RuntimePreview.d.ts +0 -11
- package/dist/authoring/RuntimePreview.js +0 -25
- package/dist/authoring/SceneDocument.d.ts +0 -74
- package/dist/authoring/SceneDocument.js +0 -332
- package/dist/authoring/SceneProjectState.d.ts +0 -20
- package/dist/authoring/SceneProjectState.js +0 -8
- package/dist/authoring/SceneSelection.d.ts +0 -11
- package/dist/authoring/SceneSelection.js +0 -1
- package/dist/authoring/index.d.ts +0 -13
- package/dist/authoring/index.js +0 -13
- package/dist/commands/Command.d.ts +0 -63
- package/dist/commands/Command.js +0 -1
- package/dist/commands/CommandStack.d.ts +0 -14
- package/dist/commands/CommandStack.js +0 -45
- package/dist/commands/applyCommand.d.ts +0 -23
- package/dist/commands/applyCommand.js +0 -316
- package/dist/commands/index.d.ts +0 -4
- package/dist/commands/index.js +0 -4
- package/dist/commands/utils.d.ts +0 -17
- package/dist/commands/utils.js +0 -77
- package/dist/commands/validateCommand.d.ts +0 -12
- package/dist/commands/validateCommand.js +0 -285
- package/dist/nodes/Input.d.ts +0 -91
- package/dist/nodes/Input.js +0 -352
- package/dist/nodes/Textarea.d.ts +0 -10
- package/dist/nodes/Textarea.js +0 -38
- package/dist/nodes/components/Button.d.ts +0 -8
- package/dist/nodes/components/Button.js +0 -45
- package/dist/nodes/components/InputField.d.ts +0 -12
- package/dist/nodes/components/InputField.js +0 -53
- package/dist/nodes/components/ProgressBar.d.ts +0 -14
- package/dist/nodes/components/ProgressBar.js +0 -66
- package/dist/nodes/components/ScrollRect.d.ts +0 -23
- package/dist/nodes/components/ScrollRect.js +0 -108
- package/dist/nodes/components/Selectable.d.ts +0 -32
- package/dist/nodes/components/Selectable.js +0 -153
- package/dist/nodes/components/index.d.ts +0 -5
- package/dist/nodes/components/index.js +0 -5
- package/dist/nodes/graphics/Graphic.d.ts +0 -14
- package/dist/nodes/graphics/Graphic.js +0 -47
- package/dist/nodes/graphics/ImageGraphic.d.ts +0 -9
- package/dist/nodes/graphics/ImageGraphic.js +0 -42
- package/dist/nodes/graphics/RoundedRectGraphic.d.ts +0 -13
- package/dist/nodes/graphics/RoundedRectGraphic.js +0 -65
- package/dist/nodes/graphics/TextGraphic.d.ts +0 -13
- package/dist/nodes/graphics/TextGraphic.js +0 -70
- package/dist/nodes/graphics/index.d.ts +0 -4
- package/dist/nodes/graphics/index.js +0 -4
- package/dist/nodes/index.d.ts +0 -3
- package/dist/nodes/index.js +0 -3
- package/dist/runtime/Application.d.ts +0 -15
- package/dist/runtime/Application.js +0 -67
- package/dist/runtime/GameObject.d.ts +0 -100
- package/dist/runtime/GameObject.js +0 -297
- package/dist/runtime/GameObjectEvent.d.ts +0 -52
- package/dist/runtime/GameObjectEvent.js +0 -38
- package/dist/runtime/Transform.d.ts +0 -32
- package/dist/runtime/Transform.js +0 -157
- package/dist/runtime/component/Component.d.ts +0 -13
- package/dist/runtime/component/Component.js +0 -13
- package/dist/runtime/component/ComponentRegistry.d.ts +0 -49
- package/dist/runtime/component/ComponentRegistry.js +0 -25
- package/dist/runtime/component/Flex.d.ts +0 -6
- package/dist/runtime/component/Flex.js +0 -15
- package/dist/runtime/component/FlexGroup.d.ts +0 -26
- package/dist/runtime/component/FlexGroup.js +0 -136
- package/dist/runtime/component/GridLayout.d.ts +0 -47
- package/dist/runtime/component/GridLayout.js +0 -129
- package/dist/runtime/component/Layout.d.ts +0 -104
- package/dist/runtime/component/Layout.js +0 -248
- package/dist/runtime/component/decorators.d.ts +0 -4
- package/dist/runtime/component/decorators.js +0 -52
- package/dist/runtime/component/index.d.ts +0 -7
- package/dist/runtime/component/index.js +0 -7
- package/dist/runtime/graphics/index.d.ts +0 -11
- package/dist/runtime/graphics/index.js +0 -29
- package/dist/runtime/group/index.d.ts +0 -39
- package/dist/runtime/group/index.js +0 -102
- package/dist/runtime/image/Image.d.ts +0 -19
- package/dist/runtime/image/Image.js +0 -60
- package/dist/runtime/image/NineSliceImage.d.ts +0 -23
- package/dist/runtime/image/NineSliceImage.js +0 -64
- package/dist/runtime/image/index.d.ts +0 -2
- package/dist/runtime/image/index.js +0 -2
- package/dist/runtime/label/Label.d.ts +0 -11
- package/dist/runtime/label/Label.js +0 -26
- package/dist/runtime/label/LabelStyle.d.ts +0 -3
- package/dist/runtime/label/LabelStyle.js +0 -3
- package/dist/runtime/label/index.d.ts +0 -2
- package/dist/runtime/label/index.js +0 -2
- package/dist/runtime/utils/index.d.ts +0 -1
- package/dist/runtime/utils/index.js +0 -1
- package/dist/runtime/utils/onlyOnceQueueMicrotask.d.ts +0 -1
- package/dist/runtime/utils/onlyOnceQueueMicrotask.js +0 -12
- package/dist/runtime/utils/setProps.d.ts +0 -10
- package/dist/runtime/utils/setProps.js +0 -17
- package/dist/scene/dsl.d.ts +0 -25
- package/dist/scene/dsl.js +0 -112
- package/dist/scene/index.d.ts +0 -5
- package/dist/scene/index.js +0 -5
- package/dist/scene/instantiate.d.ts +0 -8
- package/dist/scene/instantiate.js +0 -208
- package/dist/scene/nodesDsl.d.ts +0 -42
- package/dist/scene/nodesDsl.js +0 -169
- package/dist/scene/spec.d.ts +0 -100
- package/dist/scene/spec.js +0 -1
- package/dist/scene/templates.d.ts +0 -21
- package/dist/scene/templates.js +0 -239
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Rectangle } from "pixi.js";
|
|
8
|
-
import { Component, ComponentMeta, Prop } from "../../runtime/index.js";
|
|
9
|
-
let ScrollRect = class ScrollRect extends Component {
|
|
10
|
-
viewport;
|
|
11
|
-
content;
|
|
12
|
-
contentHeight = 0;
|
|
13
|
-
wheelSensitivity = 1;
|
|
14
|
-
dragEnabled = true;
|
|
15
|
-
scrollY = 0;
|
|
16
|
-
dragging = false;
|
|
17
|
-
dragStartY = 0;
|
|
18
|
-
dragStartScrollY = 0;
|
|
19
|
-
awake() {
|
|
20
|
-
const target = this.viewport ?? this.gameObject;
|
|
21
|
-
target.display.eventMode = 'static';
|
|
22
|
-
target.display.hitArea = new Rectangle(0, 0, target.width, target.height);
|
|
23
|
-
target.display.on('wheel', this.handleWheel, this);
|
|
24
|
-
target.display.on('pointerdown', this.handlePointerDown, this);
|
|
25
|
-
target.display.on('globalpointermove', this.handleGlobalPointerMove, this);
|
|
26
|
-
target.display.on('pointerup', this.handlePointerUp, this);
|
|
27
|
-
target.display.on('pointerupoutside', this.handlePointerUp, this);
|
|
28
|
-
target.display.on('pointercancel', this.handlePointerUp, this);
|
|
29
|
-
this.applyScroll();
|
|
30
|
-
}
|
|
31
|
-
get maxScrollY() {
|
|
32
|
-
const viewport = this.viewport ?? this.gameObject;
|
|
33
|
-
return Math.max(0, this.contentHeight - viewport.height);
|
|
34
|
-
}
|
|
35
|
-
scrollTo(y) {
|
|
36
|
-
this.scrollY = Math.min(Math.max(0, y), this.maxScrollY);
|
|
37
|
-
this.applyScroll();
|
|
38
|
-
}
|
|
39
|
-
scrollBy(deltaY) {
|
|
40
|
-
this.scrollTo(this.scrollY + deltaY);
|
|
41
|
-
}
|
|
42
|
-
applyScroll() {
|
|
43
|
-
if (this.content) {
|
|
44
|
-
this.content.y = -this.scrollY;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
handleWheel(event) {
|
|
48
|
-
if (this.maxScrollY <= 0) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
this.scrollBy(event.deltaY * this.wheelSensitivity);
|
|
54
|
-
}
|
|
55
|
-
handlePointerDown(event) {
|
|
56
|
-
if (!this.dragEnabled || this.maxScrollY <= 0) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.dragging = true;
|
|
60
|
-
this.dragStartY = event.global.y;
|
|
61
|
-
this.dragStartScrollY = this.scrollY;
|
|
62
|
-
event.stopPropagation();
|
|
63
|
-
}
|
|
64
|
-
handleGlobalPointerMove(event) {
|
|
65
|
-
if (!this.dragging) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
this.scrollTo(this.dragStartScrollY - (event.global.y - this.dragStartY));
|
|
69
|
-
event.stopPropagation();
|
|
70
|
-
}
|
|
71
|
-
handlePointerUp() {
|
|
72
|
-
this.dragging = false;
|
|
73
|
-
}
|
|
74
|
-
onDestroy() {
|
|
75
|
-
const target = this.viewport ?? this.gameObject;
|
|
76
|
-
target.display.off('wheel', this.handleWheel, this);
|
|
77
|
-
target.display.off('pointerdown', this.handlePointerDown, this);
|
|
78
|
-
target.display.off('globalpointermove', this.handleGlobalPointerMove, this);
|
|
79
|
-
target.display.off('pointerup', this.handlePointerUp, this);
|
|
80
|
-
target.display.off('pointerupoutside', this.handlePointerUp, this);
|
|
81
|
-
target.display.off('pointercancel', this.handlePointerUp, this);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
__decorate([
|
|
85
|
-
Prop({ type: 'nodeRef', description: 'Viewport node that receives scroll input.' })
|
|
86
|
-
], ScrollRect.prototype, "viewport", void 0);
|
|
87
|
-
__decorate([
|
|
88
|
-
Prop({ type: 'nodeRef', description: 'Content node moved by scroll input.' })
|
|
89
|
-
], ScrollRect.prototype, "content", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
Prop({ type: 'number', default: 0, min: 0 })
|
|
92
|
-
], ScrollRect.prototype, "contentHeight", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
Prop({ type: 'number', default: 1 })
|
|
95
|
-
], ScrollRect.prototype, "wheelSensitivity", void 0);
|
|
96
|
-
__decorate([
|
|
97
|
-
Prop({ type: 'boolean', default: true })
|
|
98
|
-
], ScrollRect.prototype, "dragEnabled", void 0);
|
|
99
|
-
ScrollRect = __decorate([
|
|
100
|
-
ComponentMeta({
|
|
101
|
-
type: 'ui.ScrollRect',
|
|
102
|
-
displayName: 'Scroll Rect',
|
|
103
|
-
category: 'UI/Interaction',
|
|
104
|
-
description: 'Moves a content node inside a viewport using wheel and drag input.',
|
|
105
|
-
disallowMultiple: true,
|
|
106
|
-
})
|
|
107
|
-
], ScrollRect);
|
|
108
|
-
export { ScrollRect };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Component } from "../../runtime/index.js";
|
|
2
|
-
import type { FederatedPointerEvent } from "pixi.js";
|
|
3
|
-
import type { Group } from "../../runtime/index.js";
|
|
4
|
-
import type { RoundedRectGraphic } from "../graphics/index.js";
|
|
5
|
-
export declare enum SelectionState {
|
|
6
|
-
Normal = "normal",
|
|
7
|
-
Highlighted = "highlighted",
|
|
8
|
-
Pressed = "pressed",
|
|
9
|
-
Disabled = "disabled"
|
|
10
|
-
}
|
|
11
|
-
export declare class Selectable extends Component<Group> {
|
|
12
|
-
interactable: boolean;
|
|
13
|
-
targetGraphic?: RoundedRectGraphic;
|
|
14
|
-
transition: 'none' | 'colorTint' | 'scale';
|
|
15
|
-
normalColor: number;
|
|
16
|
-
highlightedColor: number;
|
|
17
|
-
pressedColor: number;
|
|
18
|
-
disabledColor: number;
|
|
19
|
-
pressedScale: number;
|
|
20
|
-
protected hovered: boolean;
|
|
21
|
-
protected pressed: boolean;
|
|
22
|
-
awake(): void;
|
|
23
|
-
protected handlePointerOver(_event: FederatedPointerEvent): void;
|
|
24
|
-
protected handlePointerOut(_event: FederatedPointerEvent): void;
|
|
25
|
-
protected handlePointerDown(_event: FederatedPointerEvent): void;
|
|
26
|
-
protected handlePointerUp(_event: FederatedPointerEvent): void;
|
|
27
|
-
protected handlePointerCancel(_event: FederatedPointerEvent): void;
|
|
28
|
-
protected get state(): SelectionState;
|
|
29
|
-
protected applyState(): void;
|
|
30
|
-
private get currentColor();
|
|
31
|
-
onDestroy(): void;
|
|
32
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Component, ComponentMeta, Prop } from "../../runtime/index.js";
|
|
8
|
-
export var SelectionState;
|
|
9
|
-
(function (SelectionState) {
|
|
10
|
-
SelectionState["Normal"] = "normal";
|
|
11
|
-
SelectionState["Highlighted"] = "highlighted";
|
|
12
|
-
SelectionState["Pressed"] = "pressed";
|
|
13
|
-
SelectionState["Disabled"] = "disabled";
|
|
14
|
-
})(SelectionState || (SelectionState = {}));
|
|
15
|
-
let Selectable = class Selectable extends Component {
|
|
16
|
-
interactable = true;
|
|
17
|
-
targetGraphic;
|
|
18
|
-
transition = 'colorTint';
|
|
19
|
-
normalColor = 0x2563eb;
|
|
20
|
-
highlightedColor = 0x1d4ed8;
|
|
21
|
-
pressedColor = 0x1e40af;
|
|
22
|
-
disabledColor = 0x94a3b8;
|
|
23
|
-
pressedScale = 0.96;
|
|
24
|
-
hovered = false;
|
|
25
|
-
pressed = false;
|
|
26
|
-
awake() {
|
|
27
|
-
this.gameObject.display.eventMode = this.interactable ? 'static' : 'none';
|
|
28
|
-
this.gameObject.display.cursor = this.interactable ? 'pointer' : 'default';
|
|
29
|
-
this.gameObject.display.on('pointerover', this.handlePointerOver, this);
|
|
30
|
-
this.gameObject.display.on('pointerout', this.handlePointerOut, this);
|
|
31
|
-
this.gameObject.display.on('pointerdown', this.handlePointerDown, this);
|
|
32
|
-
this.gameObject.display.on('pointerup', this.handlePointerUp, this);
|
|
33
|
-
this.gameObject.display.on('pointerupoutside', this.handlePointerCancel, this);
|
|
34
|
-
this.gameObject.display.on('pointercancel', this.handlePointerCancel, this);
|
|
35
|
-
this.applyState();
|
|
36
|
-
}
|
|
37
|
-
handlePointerOver(_event) {
|
|
38
|
-
if (!this.interactable) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
this.hovered = true;
|
|
42
|
-
this.applyState();
|
|
43
|
-
}
|
|
44
|
-
handlePointerOut(_event) {
|
|
45
|
-
this.hovered = false;
|
|
46
|
-
this.pressed = false;
|
|
47
|
-
this.applyState();
|
|
48
|
-
}
|
|
49
|
-
handlePointerDown(_event) {
|
|
50
|
-
if (!this.interactable) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.pressed = true;
|
|
54
|
-
this.applyState();
|
|
55
|
-
}
|
|
56
|
-
handlePointerUp(_event) {
|
|
57
|
-
if (!this.interactable) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
this.pressed = false;
|
|
61
|
-
this.applyState();
|
|
62
|
-
}
|
|
63
|
-
handlePointerCancel(_event) {
|
|
64
|
-
this.pressed = false;
|
|
65
|
-
this.applyState();
|
|
66
|
-
}
|
|
67
|
-
get state() {
|
|
68
|
-
if (!this.interactable) {
|
|
69
|
-
return SelectionState.Disabled;
|
|
70
|
-
}
|
|
71
|
-
if (this.pressed) {
|
|
72
|
-
return SelectionState.Pressed;
|
|
73
|
-
}
|
|
74
|
-
if (this.hovered) {
|
|
75
|
-
return SelectionState.Highlighted;
|
|
76
|
-
}
|
|
77
|
-
return SelectionState.Normal;
|
|
78
|
-
}
|
|
79
|
-
applyState() {
|
|
80
|
-
this.gameObject.display.eventMode = this.interactable ? 'static' : 'none';
|
|
81
|
-
this.gameObject.display.cursor = this.interactable ? 'pointer' : 'default';
|
|
82
|
-
if (this.transition === 'colorTint' && this.targetGraphic) {
|
|
83
|
-
this.targetGraphic.color = this.currentColor;
|
|
84
|
-
this.targetGraphic.setDirty();
|
|
85
|
-
}
|
|
86
|
-
if (this.transition === 'scale') {
|
|
87
|
-
const scale = this.state === SelectionState.Pressed ? this.pressedScale : 1;
|
|
88
|
-
this.gameObject.scaleX = scale;
|
|
89
|
-
this.gameObject.scaleY = scale;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
get currentColor() {
|
|
93
|
-
switch (this.state) {
|
|
94
|
-
case SelectionState.Disabled:
|
|
95
|
-
return this.disabledColor;
|
|
96
|
-
case SelectionState.Pressed:
|
|
97
|
-
return this.pressedColor;
|
|
98
|
-
case SelectionState.Highlighted:
|
|
99
|
-
return this.highlightedColor;
|
|
100
|
-
default:
|
|
101
|
-
return this.normalColor;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
onDestroy() {
|
|
105
|
-
this.gameObject.display.off('pointerover', this.handlePointerOver, this);
|
|
106
|
-
this.gameObject.display.off('pointerout', this.handlePointerOut, this);
|
|
107
|
-
this.gameObject.display.off('pointerdown', this.handlePointerDown, this);
|
|
108
|
-
this.gameObject.display.off('pointerup', this.handlePointerUp, this);
|
|
109
|
-
this.gameObject.display.off('pointerupoutside', this.handlePointerCancel, this);
|
|
110
|
-
this.gameObject.display.off('pointercancel', this.handlePointerCancel, this);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
__decorate([
|
|
114
|
-
Prop({ type: 'boolean', default: true })
|
|
115
|
-
], Selectable.prototype, "interactable", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
Prop({
|
|
118
|
-
type: 'componentRef',
|
|
119
|
-
component: 'ui.Graphic',
|
|
120
|
-
description: 'Graphic changed by this selectable transition.',
|
|
121
|
-
})
|
|
122
|
-
], Selectable.prototype, "targetGraphic", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
Prop({
|
|
125
|
-
type: 'enum',
|
|
126
|
-
default: 'colorTint',
|
|
127
|
-
options: ['none', 'colorTint', 'scale'],
|
|
128
|
-
})
|
|
129
|
-
], Selectable.prototype, "transition", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
Prop({ type: 'color', default: 0x2563eb })
|
|
132
|
-
], Selectable.prototype, "normalColor", void 0);
|
|
133
|
-
__decorate([
|
|
134
|
-
Prop({ type: 'color', default: 0x1d4ed8 })
|
|
135
|
-
], Selectable.prototype, "highlightedColor", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
Prop({ type: 'color', default: 0x1e40af })
|
|
138
|
-
], Selectable.prototype, "pressedColor", void 0);
|
|
139
|
-
__decorate([
|
|
140
|
-
Prop({ type: 'color', default: 0x94a3b8 })
|
|
141
|
-
], Selectable.prototype, "disabledColor", void 0);
|
|
142
|
-
__decorate([
|
|
143
|
-
Prop({ type: 'number', default: 0.96, min: 0 })
|
|
144
|
-
], Selectable.prototype, "pressedScale", void 0);
|
|
145
|
-
Selectable = __decorate([
|
|
146
|
-
ComponentMeta({
|
|
147
|
-
type: 'ui.Selectable',
|
|
148
|
-
displayName: 'Selectable',
|
|
149
|
-
category: 'UI/Interaction',
|
|
150
|
-
description: 'Base class for pointer-driven selectable controls.',
|
|
151
|
-
})
|
|
152
|
-
], Selectable);
|
|
153
|
-
export { Selectable };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Container } from "pixi.js";
|
|
2
|
-
import { Component } from "../../runtime/index.js";
|
|
3
|
-
import type { Group } from "../../runtime/index.js";
|
|
4
|
-
export declare abstract class Graphic<TDisplay extends Container = Container> extends Component<Group> {
|
|
5
|
-
display: TDisplay;
|
|
6
|
-
private _dirty;
|
|
7
|
-
raycastTarget: boolean;
|
|
8
|
-
awake(): void;
|
|
9
|
-
protected abstract createDisplay(): void;
|
|
10
|
-
protected abstract redraw(): void;
|
|
11
|
-
setDirty(): void;
|
|
12
|
-
private redrawNow;
|
|
13
|
-
onDestroy(): void;
|
|
14
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Component, ComponentMeta, Prop } from "../../runtime/index.js";
|
|
8
|
-
let Graphic = class Graphic extends Component {
|
|
9
|
-
display;
|
|
10
|
-
_dirty = true;
|
|
11
|
-
raycastTarget = true;
|
|
12
|
-
awake() {
|
|
13
|
-
this.createDisplay();
|
|
14
|
-
this.gameObject.display.addChild(this.display);
|
|
15
|
-
this.redrawNow();
|
|
16
|
-
}
|
|
17
|
-
setDirty() {
|
|
18
|
-
this._dirty = true;
|
|
19
|
-
this.redrawNow();
|
|
20
|
-
}
|
|
21
|
-
redrawNow() {
|
|
22
|
-
if (!this._dirty || !this.display) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
this._dirty = false;
|
|
26
|
-
this.redraw();
|
|
27
|
-
}
|
|
28
|
-
onDestroy() {
|
|
29
|
-
this.display?.destroy();
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
__decorate([
|
|
33
|
-
Prop({
|
|
34
|
-
type: 'boolean',
|
|
35
|
-
default: true,
|
|
36
|
-
description: 'Whether this graphic can be used as an interaction raycast target.',
|
|
37
|
-
})
|
|
38
|
-
], Graphic.prototype, "raycastTarget", void 0);
|
|
39
|
-
Graphic = __decorate([
|
|
40
|
-
ComponentMeta({
|
|
41
|
-
type: 'ui.Graphic',
|
|
42
|
-
displayName: 'Graphic',
|
|
43
|
-
category: 'UI/Graphic',
|
|
44
|
-
description: 'Base class for renderable UI graphics.',
|
|
45
|
-
})
|
|
46
|
-
], Graphic);
|
|
47
|
-
export { Graphic };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Sprite, Texture } from "pixi.js";
|
|
8
|
-
import { ComponentMeta, GameObject, Prop } from "../../runtime/index.js";
|
|
9
|
-
import { Graphic } from "./Graphic.js";
|
|
10
|
-
let ImageGraphic = class ImageGraphic extends Graphic {
|
|
11
|
-
src = '';
|
|
12
|
-
tint = 0xffffff;
|
|
13
|
-
createDisplay() {
|
|
14
|
-
this.display = new Sprite(Texture.EMPTY);
|
|
15
|
-
this.gameObject.emitter.on(GameObject.Event.RESIZE, this.setDirty, this);
|
|
16
|
-
}
|
|
17
|
-
redraw() {
|
|
18
|
-
this.display.texture = this.src ? Texture.from(this.src) : Texture.EMPTY;
|
|
19
|
-
this.display.width = this.gameObject.width;
|
|
20
|
-
this.display.height = this.gameObject.height;
|
|
21
|
-
this.display.tint = this.tint;
|
|
22
|
-
}
|
|
23
|
-
onDestroy() {
|
|
24
|
-
this.gameObject.emitter.off(GameObject.Event.RESIZE, this.setDirty, this);
|
|
25
|
-
super.onDestroy();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
__decorate([
|
|
29
|
-
Prop({ type: 'assetRef', default: '', assetType: 'image' })
|
|
30
|
-
], ImageGraphic.prototype, "src", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
Prop({ type: 'color', default: 0xffffff })
|
|
33
|
-
], ImageGraphic.prototype, "tint", void 0);
|
|
34
|
-
ImageGraphic = __decorate([
|
|
35
|
-
ComponentMeta({
|
|
36
|
-
type: 'ui.ImageGraphic',
|
|
37
|
-
displayName: 'Image',
|
|
38
|
-
category: 'UI/Graphic',
|
|
39
|
-
description: 'Draws an image sprite using the host group logical size.',
|
|
40
|
-
})
|
|
41
|
-
], ImageGraphic);
|
|
42
|
-
export { ImageGraphic };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Graphics as PixiGraphics } from "pixi.js";
|
|
2
|
-
import { Graphic } from "./Graphic.js";
|
|
3
|
-
export declare class RoundedRectGraphic extends Graphic<PixiGraphics> {
|
|
4
|
-
color: number;
|
|
5
|
-
fillAlpha: number;
|
|
6
|
-
radius: number;
|
|
7
|
-
strokeColor: number;
|
|
8
|
-
strokeWidth: number;
|
|
9
|
-
strokeAlpha: number;
|
|
10
|
-
protected createDisplay(): void;
|
|
11
|
-
protected redraw(): void;
|
|
12
|
-
onDestroy(): void;
|
|
13
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Graphics as PixiGraphics } from "pixi.js";
|
|
8
|
-
import { ComponentMeta, GameObject, Prop } from "../../runtime/index.js";
|
|
9
|
-
import { Graphic } from "./Graphic.js";
|
|
10
|
-
let RoundedRectGraphic = class RoundedRectGraphic extends Graphic {
|
|
11
|
-
color = 0xffffff;
|
|
12
|
-
fillAlpha = 1;
|
|
13
|
-
radius = 0;
|
|
14
|
-
strokeColor = 0x000000;
|
|
15
|
-
strokeWidth = 0;
|
|
16
|
-
strokeAlpha = 1;
|
|
17
|
-
createDisplay() {
|
|
18
|
-
this.display = new PixiGraphics();
|
|
19
|
-
this.gameObject.emitter.on(GameObject.Event.RESIZE, this.setDirty, this);
|
|
20
|
-
}
|
|
21
|
-
redraw() {
|
|
22
|
-
this.display.clear();
|
|
23
|
-
this.display
|
|
24
|
-
.roundRect(0, 0, this.gameObject.width, this.gameObject.height, this.radius)
|
|
25
|
-
.fill({ color: this.color, alpha: this.fillAlpha });
|
|
26
|
-
if (this.strokeWidth > 0) {
|
|
27
|
-
this.display.stroke({
|
|
28
|
-
width: this.strokeWidth,
|
|
29
|
-
color: this.strokeColor,
|
|
30
|
-
alpha: this.strokeAlpha,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
onDestroy() {
|
|
35
|
-
this.gameObject.emitter.off(GameObject.Event.RESIZE, this.setDirty, this);
|
|
36
|
-
super.onDestroy();
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
__decorate([
|
|
40
|
-
Prop({ type: 'color', default: 0xffffff })
|
|
41
|
-
], RoundedRectGraphic.prototype, "color", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
Prop({ type: 'number', default: 1, min: 0, max: 1 })
|
|
44
|
-
], RoundedRectGraphic.prototype, "fillAlpha", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
Prop({ type: 'number', default: 0, min: 0 })
|
|
47
|
-
], RoundedRectGraphic.prototype, "radius", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
Prop({ type: 'color', default: 0x000000 })
|
|
50
|
-
], RoundedRectGraphic.prototype, "strokeColor", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
Prop({ type: 'number', default: 0, min: 0 })
|
|
53
|
-
], RoundedRectGraphic.prototype, "strokeWidth", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
Prop({ type: 'number', default: 1, min: 0, max: 1 })
|
|
56
|
-
], RoundedRectGraphic.prototype, "strokeAlpha", void 0);
|
|
57
|
-
RoundedRectGraphic = __decorate([
|
|
58
|
-
ComponentMeta({
|
|
59
|
-
type: 'ui.RoundedRectGraphic',
|
|
60
|
-
displayName: 'Rounded Rect',
|
|
61
|
-
category: 'UI/Graphic',
|
|
62
|
-
description: 'Draws a rounded rectangle using the host group logical size.',
|
|
63
|
-
})
|
|
64
|
-
], RoundedRectGraphic);
|
|
65
|
-
export { RoundedRectGraphic };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Text } from "pixi.js";
|
|
2
|
-
import type { TextStyleFontWeight } from "pixi.js";
|
|
3
|
-
import { Graphic } from "./Graphic.js";
|
|
4
|
-
export declare class TextGraphic extends Graphic<Text> {
|
|
5
|
-
text: string;
|
|
6
|
-
color: number;
|
|
7
|
-
fontSize: number;
|
|
8
|
-
fontFamily: string | string[];
|
|
9
|
-
fontWeight: TextStyleFontWeight;
|
|
10
|
-
center: boolean;
|
|
11
|
-
protected createDisplay(): void;
|
|
12
|
-
protected redraw(): void;
|
|
13
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Text } from "pixi.js";
|
|
8
|
-
import { ComponentMeta, Prop } from "../../runtime/index.js";
|
|
9
|
-
import { Graphic } from "./Graphic.js";
|
|
10
|
-
let TextGraphic = class TextGraphic extends Graphic {
|
|
11
|
-
text = '';
|
|
12
|
-
color = 0x000000;
|
|
13
|
-
fontSize = 14;
|
|
14
|
-
fontFamily = 'Arial';
|
|
15
|
-
fontWeight = 'normal';
|
|
16
|
-
center = false;
|
|
17
|
-
createDisplay() {
|
|
18
|
-
this.display = new Text();
|
|
19
|
-
}
|
|
20
|
-
redraw() {
|
|
21
|
-
this.display.text = this.text;
|
|
22
|
-
this.display.style = {
|
|
23
|
-
fill: this.color,
|
|
24
|
-
fontFamily: this.fontFamily,
|
|
25
|
-
fontSize: this.fontSize,
|
|
26
|
-
fontWeight: this.fontWeight,
|
|
27
|
-
};
|
|
28
|
-
if (this.center) {
|
|
29
|
-
this.display.anchor.set(0.5);
|
|
30
|
-
this.display.x = this.gameObject.width / 2;
|
|
31
|
-
this.display.y = this.gameObject.height / 2;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.display.anchor.set(0);
|
|
35
|
-
this.display.x = 0;
|
|
36
|
-
this.display.y = 0;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
__decorate([
|
|
41
|
-
Prop({ type: 'string', default: '' })
|
|
42
|
-
], TextGraphic.prototype, "text", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
Prop({ type: 'color', default: 0x000000 })
|
|
45
|
-
], TextGraphic.prototype, "color", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
Prop({ type: 'number', default: 14, min: 1 })
|
|
48
|
-
], TextGraphic.prototype, "fontSize", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
Prop({ type: 'string', default: 'Arial' })
|
|
51
|
-
], TextGraphic.prototype, "fontFamily", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
Prop({
|
|
54
|
-
type: 'enum',
|
|
55
|
-
default: 'normal',
|
|
56
|
-
options: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
|
57
|
-
})
|
|
58
|
-
], TextGraphic.prototype, "fontWeight", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
Prop({ type: 'boolean', default: false })
|
|
61
|
-
], TextGraphic.prototype, "center", void 0);
|
|
62
|
-
TextGraphic = __decorate([
|
|
63
|
-
ComponentMeta({
|
|
64
|
-
type: 'ui.TextGraphic',
|
|
65
|
-
displayName: 'Text',
|
|
66
|
-
category: 'UI/Graphic',
|
|
67
|
-
description: 'Draws a text label on the host group.',
|
|
68
|
-
})
|
|
69
|
-
], TextGraphic);
|
|
70
|
-
export { TextGraphic };
|
package/dist/nodes/index.d.ts
DELETED
package/dist/nodes/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as PIXI from 'pixi.js';
|
|
2
|
-
import type { RendererDestroyOptions, DestroyOptions } from 'pixi.js';
|
|
3
|
-
import { GameObject } from './GameObject.js';
|
|
4
|
-
import { Group } from './group/index.js';
|
|
5
|
-
export declare class Application extends PIXI.Application {
|
|
6
|
-
root: Group;
|
|
7
|
-
private updateTargets;
|
|
8
|
-
private isUpdateTickerRegistered;
|
|
9
|
-
private updateGameObjects;
|
|
10
|
-
init(options?: Partial<PIXI.ApplicationOptions>): Promise<void>;
|
|
11
|
-
registerUpdateTarget(target: GameObject): void;
|
|
12
|
-
unregisterUpdateTarget(target: GameObject): void;
|
|
13
|
-
private syncUpdateTicker;
|
|
14
|
-
destroy(rendererDestroyOptions?: RendererDestroyOptions, options?: DestroyOptions): void;
|
|
15
|
-
}
|