@galacean/effects-plugin-gui 2.10.0-alpha.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/LICENSE +22 -0
- package/README.md +33 -0
- package/dist/components/gui-window-component.d.ts +15 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/ui-canvas.d.ts +28 -0
- package/dist/components/ui-control.d.ts +40 -0
- package/dist/controls/base-button.d.ts +85 -0
- package/dist/controls/button.d.ts +44 -0
- package/dist/controls/check-button.d.ts +10 -0
- package/dist/controls/checkbox.d.ts +12 -0
- package/dist/controls/color-picker.d.ts +59 -0
- package/dist/controls/color-rect.d.ts +11 -0
- package/dist/controls/enums.d.ts +68 -0
- package/dist/controls/index.d.ts +19 -0
- package/dist/controls/label.d.ts +46 -0
- package/dist/controls/line-edit.d.ts +28 -0
- package/dist/controls/menu-button.d.ts +39 -0
- package/dist/controls/nine-patch-rect.d.ts +35 -0
- package/dist/controls/panel.d.ts +9 -0
- package/dist/controls/popup-menu.d.ts +44 -0
- package/dist/controls/popup.d.ts +23 -0
- package/dist/controls/progress-bar.d.ts +19 -0
- package/dist/controls/slider.d.ts +63 -0
- package/dist/controls/text-edit.d.ts +21 -0
- package/dist/controls/text-input.d.ts +92 -0
- package/dist/controls/texture-rect.d.ts +30 -0
- package/dist/core/control.d.ts +379 -0
- package/dist/core/data.d.ts +88 -0
- package/dist/core/enums.d.ts +42 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/roots.d.ts +97 -0
- package/dist/core/theme.d.ts +186 -0
- package/dist/data.d.ts +147 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +10886 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +8 -0
- package/dist/index.min.js.map +1 -0
- package/dist/index.mjs +10858 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layout/aspect-ratio-container.d.ts +26 -0
- package/dist/layout/box-container.d.ts +35 -0
- package/dist/layout/center-container.d.ts +15 -0
- package/dist/layout/enums.d.ts +15 -0
- package/dist/layout/grid-container.d.ts +19 -0
- package/dist/layout/margin-container.d.ts +10 -0
- package/dist/layout/panel-container.d.ts +10 -0
- package/dist/layout/separator.d.ts +19 -0
- package/dist/layout/utils.d.ts +10 -0
- package/dist/plugin/gui-plugin.d.ts +8 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/scroll/enums.d.ts +8 -0
- package/dist/scroll/range.d.ts +56 -0
- package/dist/scroll/scroll-bar.d.ts +69 -0
- package/dist/scroll/scroll-container.d.ts +84 -0
- package/dist/theme/default-theme.d.ts +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-present Ant Group Co., Ltd. https://www.antgroup.com/
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @galacean/effects-plugin-gui
|
|
2
|
+
|
|
3
|
+
Concrete GUI behavior for Galacean Effects. The core package owns only the
|
|
4
|
+
`Control`, `Container`, GUI roots and input bridge
|
|
5
|
+
protocols; automatic layout algorithms and future widgets/themes belong here.
|
|
6
|
+
|
|
7
|
+
The package currently exports:
|
|
8
|
+
|
|
9
|
+
- `BoxContainer`, `HBoxContainer`, `VBoxContainer`
|
|
10
|
+
- `GridContainer`
|
|
11
|
+
- `MarginContainer`
|
|
12
|
+
- `CenterContainer`
|
|
13
|
+
- `AspectRatioContainer`
|
|
14
|
+
|
|
15
|
+
Importing the package does not register a plugin and has no logging side
|
|
16
|
+
effects. Create controls with the same `Engine` used by the owning GUI tree.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import type { Engine } from '@galacean/effects';
|
|
20
|
+
import { Control, SizeFlags } from '@galacean/effects';
|
|
21
|
+
import { HBoxContainer } from '@galacean/effects-plugin-gui';
|
|
22
|
+
|
|
23
|
+
function createRow (engine: Engine): HBoxContainer {
|
|
24
|
+
const row = new HBoxContainer(engine);
|
|
25
|
+
const child = new Control(engine);
|
|
26
|
+
|
|
27
|
+
row.setThemeConstantOverride('separation', 12);
|
|
28
|
+
child.setSizeFlags(SizeFlags.ExpandFill, SizeFlags.Fill);
|
|
29
|
+
row.addChild(child);
|
|
30
|
+
|
|
31
|
+
return row;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from '@galacean/effects';
|
|
2
|
+
import type { Engine } from '@galacean/effects';
|
|
3
|
+
import { WindowRootControl } from '../core/roots';
|
|
4
|
+
/** Engine-level owner for the GUI window root and its runtime subscriptions. */
|
|
5
|
+
export declare class GUIWindowComponent extends Component {
|
|
6
|
+
readonly windowRoot: WindowRootControl;
|
|
7
|
+
private disposed;
|
|
8
|
+
private readonly updateWindowRoot;
|
|
9
|
+
private readonly renderWindowRoot;
|
|
10
|
+
private readonly resizeWindowRoot;
|
|
11
|
+
private readonly pushInput;
|
|
12
|
+
private readonly onCanvasBlur;
|
|
13
|
+
constructor(engine: Engine);
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component } from '@galacean/effects';
|
|
2
|
+
import type { Engine } from '@galacean/effects';
|
|
3
|
+
import { CanvasRootControl } from '../core/roots';
|
|
4
|
+
export declare enum CanvasRenderMode {
|
|
5
|
+
ScreenSpace = 0,
|
|
6
|
+
CameraSpace = 1,
|
|
7
|
+
WorldSpace = 2,
|
|
8
|
+
WorldSpaceFaceCamera = 3
|
|
9
|
+
}
|
|
10
|
+
/** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */
|
|
11
|
+
export declare class UICanvas extends Component {
|
|
12
|
+
readonly rootControl: CanvasRootControl;
|
|
13
|
+
renderMode: CanvasRenderMode;
|
|
14
|
+
receivesEvents: boolean;
|
|
15
|
+
private _order;
|
|
16
|
+
private registered;
|
|
17
|
+
constructor(engine: Engine);
|
|
18
|
+
get order(): number;
|
|
19
|
+
set order(value: number);
|
|
20
|
+
get isVisible(): boolean;
|
|
21
|
+
onEnable(): void;
|
|
22
|
+
onDisable(): void;
|
|
23
|
+
onDestroy(): void;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
private register;
|
|
26
|
+
private unregister;
|
|
27
|
+
private destroyCanvas;
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Component } from '@galacean/effects';
|
|
2
|
+
import type { Engine, spec } from '@galacean/effects';
|
|
3
|
+
import type { Control } from '../core/control';
|
|
4
|
+
/**
|
|
5
|
+
* Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
|
|
6
|
+
* serialization while the Control tree owns layout, drawing and input.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UIControl extends Component {
|
|
9
|
+
static fallbackParentGetDelegate?: (control: UIControl) => Control | null;
|
|
10
|
+
private controlNode;
|
|
11
|
+
private linkedItemTransform;
|
|
12
|
+
private linkedControl;
|
|
13
|
+
private syncingLocation;
|
|
14
|
+
private readonly itemTransformChanged;
|
|
15
|
+
private readonly controlLocationChanged;
|
|
16
|
+
constructor(engine: Engine);
|
|
17
|
+
get control(): Control | null;
|
|
18
|
+
set control(value: Control | null);
|
|
19
|
+
get hasControl(): boolean;
|
|
20
|
+
onAwake(): void;
|
|
21
|
+
onEnable(): void;
|
|
22
|
+
onDisable(): void;
|
|
23
|
+
onParentChanged(): void;
|
|
24
|
+
onOrderInParentChanged(): void;
|
|
25
|
+
onDestroy(): void;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
/** Unlinks the GUI object without disposing or modifying it. */
|
|
28
|
+
unlinkControl(): void;
|
|
29
|
+
private attachControl;
|
|
30
|
+
private disposeControl;
|
|
31
|
+
private syncControl;
|
|
32
|
+
private syncControlOrder;
|
|
33
|
+
private resolveParent;
|
|
34
|
+
private bindLocationSync;
|
|
35
|
+
private unbindLocationSync;
|
|
36
|
+
private syncItemLocationToControl;
|
|
37
|
+
private syncControlLocationToItem;
|
|
38
|
+
private copyItemLocationToControl;
|
|
39
|
+
fromData(data: spec.ComponentData): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { MouseButtonMask } from '@galacean/effects';
|
|
2
|
+
import type { Engine, EventEmitterListener, InputEventKey, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch } from '@galacean/effects';
|
|
3
|
+
import { Control } from '../core/control';
|
|
4
|
+
import type { ControlEvent, RootControl } from '../core/control';
|
|
5
|
+
import { FocusMode, MouseFilter } from '../core/enums';
|
|
6
|
+
import { ButtonActionMode, ButtonDrawMode } from './enums';
|
|
7
|
+
import type { BaseButtonData } from '../data';
|
|
8
|
+
export type BaseButtonEvent = ControlEvent & {
|
|
9
|
+
buttonDown: [];
|
|
10
|
+
buttonUp: [];
|
|
11
|
+
pressed: [];
|
|
12
|
+
toggled: [pressed: boolean];
|
|
13
|
+
};
|
|
14
|
+
export type ButtonGroupEvent = {
|
|
15
|
+
pressed: [button: BaseButton];
|
|
16
|
+
};
|
|
17
|
+
export declare class ButtonGroup {
|
|
18
|
+
private readonly buttons;
|
|
19
|
+
private readonly eventEmitter;
|
|
20
|
+
allowUnpress: boolean;
|
|
21
|
+
on<E extends keyof ButtonGroupEvent>(eventName: E, listener: EventEmitterListener<ButtonGroupEvent[E]>): void;
|
|
22
|
+
off<E extends keyof ButtonGroupEvent>(eventName: E, listener: EventEmitterListener<ButtonGroupEvent[E]>): void;
|
|
23
|
+
getPressedButton(): BaseButton | null;
|
|
24
|
+
getButtons(): BaseButton[];
|
|
25
|
+
select(button: BaseButton, signal: boolean, emitPressed?: boolean): boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class BaseButton extends Control {
|
|
28
|
+
static readonly themeType: string;
|
|
29
|
+
private readonly buttonEventEmitter;
|
|
30
|
+
private _disabled;
|
|
31
|
+
private _toggleMode;
|
|
32
|
+
private _buttonPressed;
|
|
33
|
+
private _buttonMask;
|
|
34
|
+
private _buttonGroup;
|
|
35
|
+
private hovered;
|
|
36
|
+
private pressing;
|
|
37
|
+
private pressInside;
|
|
38
|
+
private mousePressing;
|
|
39
|
+
private keyboardPressing;
|
|
40
|
+
private touchIndex;
|
|
41
|
+
private readonly controlStateChanged;
|
|
42
|
+
actionMode: ButtonActionMode;
|
|
43
|
+
keepPressedOutside: boolean;
|
|
44
|
+
constructor(engine: Engine);
|
|
45
|
+
get disabled(): boolean;
|
|
46
|
+
set disabled(value: boolean);
|
|
47
|
+
get toggleMode(): boolean;
|
|
48
|
+
set toggleMode(value: boolean);
|
|
49
|
+
get buttonPressed(): boolean;
|
|
50
|
+
set buttonPressed(value: boolean);
|
|
51
|
+
get buttonMask(): MouseButtonMask;
|
|
52
|
+
set buttonMask(value: MouseButtonMask);
|
|
53
|
+
get buttonGroup(): ButtonGroup | null;
|
|
54
|
+
set buttonGroup(value: ButtonGroup | null);
|
|
55
|
+
on<E extends keyof BaseButtonEvent>(eventName: E, listener: EventEmitterListener<BaseButtonEvent[E]>): void;
|
|
56
|
+
off<E extends keyof BaseButtonEvent>(eventName: E, listener: EventEmitterListener<BaseButtonEvent[E]>): void;
|
|
57
|
+
setPressedNoSignal(value: boolean): void;
|
|
58
|
+
isHovered(): boolean;
|
|
59
|
+
isPressing(): boolean;
|
|
60
|
+
getDrawMode(): ButtonDrawMode;
|
|
61
|
+
getEffectiveMouseFilter(): MouseFilter;
|
|
62
|
+
getFocusModeWithOverride(): FocusMode;
|
|
63
|
+
onMouseEnter(): void;
|
|
64
|
+
onMouseMove(event: InputEventMouseMotion): void;
|
|
65
|
+
onMouseLeave(): void;
|
|
66
|
+
onMouseDown(event: InputEventMouseButton): void;
|
|
67
|
+
onMouseUp(event: InputEventMouseButton): void;
|
|
68
|
+
onTouchDown(event: InputEventScreenTouch): void;
|
|
69
|
+
onTouchMove(event: InputEventScreenDrag): void;
|
|
70
|
+
onTouchUp(event: InputEventScreenTouch): void;
|
|
71
|
+
onKeyDown(event: InputEventKey): void;
|
|
72
|
+
onKeyUp(event: InputEventKey): void;
|
|
73
|
+
onLostFocus(): void;
|
|
74
|
+
onScrollBegin(): void;
|
|
75
|
+
onDestroy(): void;
|
|
76
|
+
setPressedFromGroup(value: boolean, signal: boolean): void;
|
|
77
|
+
protected onRootChanged(previousRoot: RootControl | null, nextRoot: RootControl | null): void;
|
|
78
|
+
private setPressed;
|
|
79
|
+
private setPressedDirect;
|
|
80
|
+
private beginPress;
|
|
81
|
+
private finishPress;
|
|
82
|
+
private cancelPress;
|
|
83
|
+
private activate;
|
|
84
|
+
fromData(data: BaseButtonData): void;
|
|
85
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine, Texture } from '@galacean/effects';
|
|
3
|
+
import type { ButtonData } from '../data';
|
|
4
|
+
import { BaseButton } from './base-button';
|
|
5
|
+
import { ButtonDrawMode, HorizontalAlignment, VerticalAlignment } from './enums';
|
|
6
|
+
export type ContentInsets = {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
right: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
};
|
|
12
|
+
export declare class Button extends BaseButton {
|
|
13
|
+
static readonly themeType: string;
|
|
14
|
+
private _text;
|
|
15
|
+
private _icon;
|
|
16
|
+
flat: boolean;
|
|
17
|
+
clipText: boolean;
|
|
18
|
+
expandIcon: boolean;
|
|
19
|
+
textAlignment: HorizontalAlignment;
|
|
20
|
+
iconAlignment: HorizontalAlignment;
|
|
21
|
+
iconVerticalAlignment: VerticalAlignment;
|
|
22
|
+
constructor(engine: Engine, text?: string);
|
|
23
|
+
get text(): string;
|
|
24
|
+
set text(value: string);
|
|
25
|
+
get icon(): Texture | null;
|
|
26
|
+
set icon(value: Texture | null);
|
|
27
|
+
getMinimumSize(): math.Vector2;
|
|
28
|
+
getDesiredSize(): math.Vector2;
|
|
29
|
+
draw(): void;
|
|
30
|
+
protected getContentInsets(): ContentInsets;
|
|
31
|
+
protected getNormalContentInsets(): ContentInsets;
|
|
32
|
+
protected drawDecoration(mode: ButtonDrawMode): void;
|
|
33
|
+
private measureButton;
|
|
34
|
+
private getStyleBoxName;
|
|
35
|
+
private drawContent;
|
|
36
|
+
private getFontColor;
|
|
37
|
+
private getIconTint;
|
|
38
|
+
protected getBaseContentInsets(): ContentInsets;
|
|
39
|
+
private getIconSize;
|
|
40
|
+
private getAlignedX;
|
|
41
|
+
private getAlignedY;
|
|
42
|
+
private ellipsizeText;
|
|
43
|
+
fromData(data: ButtonData): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Engine } from '@galacean/effects';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
import type { ContentInsets } from './button';
|
|
4
|
+
export declare class CheckButton extends Button {
|
|
5
|
+
static readonly themeType: string;
|
|
6
|
+
constructor(engine: Engine, text?: string);
|
|
7
|
+
protected getContentInsets(): ContentInsets;
|
|
8
|
+
protected drawDecoration(): void;
|
|
9
|
+
private getSwitchSize;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Engine } from '@galacean/effects';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
import type { ContentInsets } from './button';
|
|
4
|
+
export declare class Checkbox extends Button {
|
|
5
|
+
static readonly themeType: string;
|
|
6
|
+
constructor(engine: Engine, text?: string);
|
|
7
|
+
protected getContentInsets(): ContentInsets;
|
|
8
|
+
protected drawDecoration(): void;
|
|
9
|
+
private fillRoundedMark;
|
|
10
|
+
private fillCheckMark;
|
|
11
|
+
private getMarkSize;
|
|
12
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine, EventEmitterListener } from '@galacean/effects';
|
|
3
|
+
import type { ColorPickerButtonData, ColorPickerData } from '../data';
|
|
4
|
+
import type { ControlEvent } from '../core/control';
|
|
5
|
+
import { VBoxContainer } from '../layout/box-container';
|
|
6
|
+
import { PopupPanel } from './popup';
|
|
7
|
+
import { Button } from './button';
|
|
8
|
+
import type { ContentInsets } from './button';
|
|
9
|
+
import type { ButtonDrawMode } from './enums';
|
|
10
|
+
import type { BaseButtonEvent } from './base-button';
|
|
11
|
+
export type ColorPickerEvent = ControlEvent & {
|
|
12
|
+
colorChanged: [color: math.Color];
|
|
13
|
+
};
|
|
14
|
+
export type ColorPickerButtonEvent = BaseButtonEvent & {
|
|
15
|
+
colorChanged: [color: math.Color];
|
|
16
|
+
};
|
|
17
|
+
export declare class ColorPicker extends VBoxContainer {
|
|
18
|
+
static readonly themeType: string;
|
|
19
|
+
private readonly colorEventEmitter;
|
|
20
|
+
private readonly plane;
|
|
21
|
+
private readonly hueBar;
|
|
22
|
+
private readonly alphaSlider;
|
|
23
|
+
private readonly channelFields;
|
|
24
|
+
private readonly hexField;
|
|
25
|
+
private readonly currentColor;
|
|
26
|
+
private syncing;
|
|
27
|
+
private _editAlpha;
|
|
28
|
+
constructor(engine: Engine);
|
|
29
|
+
get color(): math.Color;
|
|
30
|
+
set color(value: math.Color);
|
|
31
|
+
get editAlpha(): boolean;
|
|
32
|
+
set editAlpha(value: boolean);
|
|
33
|
+
on<E extends keyof ColorPickerEvent>(eventName: E, listener: EventEmitterListener<ColorPickerEvent[E]>): void;
|
|
34
|
+
off<E extends keyof ColorPickerEvent>(eventName: E, listener: EventEmitterListener<ColorPickerEvent[E]>): void;
|
|
35
|
+
setColor(value: math.Color, signal?: boolean): void;
|
|
36
|
+
private syncEditors;
|
|
37
|
+
private submitChannel;
|
|
38
|
+
private submitHex;
|
|
39
|
+
fromData(data: ColorPickerData): void;
|
|
40
|
+
}
|
|
41
|
+
export declare class ColorPickerButton extends Button {
|
|
42
|
+
static readonly themeType: string;
|
|
43
|
+
readonly picker: ColorPicker;
|
|
44
|
+
readonly popupPanel: PopupPanel;
|
|
45
|
+
private readonly colorEventEmitter;
|
|
46
|
+
private readonly openPicker;
|
|
47
|
+
constructor(engine: Engine);
|
|
48
|
+
get color(): math.Color;
|
|
49
|
+
set color(value: math.Color);
|
|
50
|
+
get editAlpha(): boolean;
|
|
51
|
+
set editAlpha(value: boolean);
|
|
52
|
+
on<E extends keyof ColorPickerButtonEvent>(eventName: E, listener: EventEmitterListener<ColorPickerButtonEvent[E]>): void;
|
|
53
|
+
off<E extends keyof ColorPickerButtonEvent>(eventName: E, listener: EventEmitterListener<ColorPickerButtonEvent[E]>): void;
|
|
54
|
+
showPicker(): void;
|
|
55
|
+
protected getContentInsets(): ContentInsets;
|
|
56
|
+
protected drawDecoration(_mode: ButtonDrawMode): void;
|
|
57
|
+
onDestroy(): void;
|
|
58
|
+
fromData(data: ColorPickerButtonData): void;
|
|
59
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine } from '@galacean/effects';
|
|
3
|
+
import { Control } from '../core/control';
|
|
4
|
+
import type { ColorRectData } from '../data';
|
|
5
|
+
export declare class ColorRect extends Control {
|
|
6
|
+
static readonly themeType: string;
|
|
7
|
+
color: math.Color;
|
|
8
|
+
constructor(engine: Engine);
|
|
9
|
+
draw(): void;
|
|
10
|
+
fromData(data: ColorRectData): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare enum HorizontalAlignment {
|
|
2
|
+
Left = 0,
|
|
3
|
+
Center = 1,
|
|
4
|
+
Right = 2,
|
|
5
|
+
Fill = 3
|
|
6
|
+
}
|
|
7
|
+
export declare enum VerticalAlignment {
|
|
8
|
+
Top = 0,
|
|
9
|
+
Center = 1,
|
|
10
|
+
Bottom = 2,
|
|
11
|
+
Fill = 3
|
|
12
|
+
}
|
|
13
|
+
export declare enum AutowrapMode {
|
|
14
|
+
Off = 0,
|
|
15
|
+
Arbitrary = 1,
|
|
16
|
+
Word = 2,
|
|
17
|
+
WordSmart = 3
|
|
18
|
+
}
|
|
19
|
+
export declare enum TextOverflow {
|
|
20
|
+
Visible = 0,
|
|
21
|
+
Clip = 1,
|
|
22
|
+
Ellipsis = 2
|
|
23
|
+
}
|
|
24
|
+
export declare enum TextureExpandMode {
|
|
25
|
+
KeepSize = 0,
|
|
26
|
+
IgnoreSize = 1,
|
|
27
|
+
FitWidth = 2,
|
|
28
|
+
FitWidthProportional = 3,
|
|
29
|
+
FitHeight = 4,
|
|
30
|
+
FitHeightProportional = 5
|
|
31
|
+
}
|
|
32
|
+
export declare enum TextureStretchMode {
|
|
33
|
+
Scale = 0,
|
|
34
|
+
Tile = 1,
|
|
35
|
+
Keep = 2,
|
|
36
|
+
KeepCentered = 3,
|
|
37
|
+
KeepAspect = 4,
|
|
38
|
+
KeepAspectCentered = 5,
|
|
39
|
+
KeepAspectCovered = 6
|
|
40
|
+
}
|
|
41
|
+
export declare enum AxisStretchMode {
|
|
42
|
+
Stretch = 0,
|
|
43
|
+
Tile = 1,
|
|
44
|
+
TileFit = 2
|
|
45
|
+
}
|
|
46
|
+
export declare enum Side {
|
|
47
|
+
Left = 0,
|
|
48
|
+
Top = 1,
|
|
49
|
+
Right = 2,
|
|
50
|
+
Bottom = 3
|
|
51
|
+
}
|
|
52
|
+
export declare enum ButtonDrawMode {
|
|
53
|
+
Normal = 0,
|
|
54
|
+
Pressed = 1,
|
|
55
|
+
Hover = 2,
|
|
56
|
+
Disabled = 3,
|
|
57
|
+
HoverPressed = 4
|
|
58
|
+
}
|
|
59
|
+
export declare enum ButtonActionMode {
|
|
60
|
+
Press = 0,
|
|
61
|
+
Release = 1
|
|
62
|
+
}
|
|
63
|
+
export declare enum ProgressFillMode {
|
|
64
|
+
BeginToEnd = 0,
|
|
65
|
+
EndToBegin = 1,
|
|
66
|
+
TopToBottom = 2,
|
|
67
|
+
BottomToTop = 3
|
|
68
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './enums';
|
|
2
|
+
export * from './label';
|
|
3
|
+
export * from './texture-rect';
|
|
4
|
+
export * from './nine-patch-rect';
|
|
5
|
+
export * from './color-rect';
|
|
6
|
+
export * from './panel';
|
|
7
|
+
export * from './base-button';
|
|
8
|
+
export * from './button';
|
|
9
|
+
export * from './checkbox';
|
|
10
|
+
export * from './check-button';
|
|
11
|
+
export * from './slider';
|
|
12
|
+
export * from './progress-bar';
|
|
13
|
+
export * from './text-input';
|
|
14
|
+
export * from './line-edit';
|
|
15
|
+
export * from './text-edit';
|
|
16
|
+
export * from './popup';
|
|
17
|
+
export * from './popup-menu';
|
|
18
|
+
export * from './menu-button';
|
|
19
|
+
export * from './color-picker';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine } from '@galacean/effects';
|
|
3
|
+
import { Control } from '../core/control';
|
|
4
|
+
import type { LabelData } from '../data';
|
|
5
|
+
import { AutowrapMode, HorizontalAlignment, TextOverflow, VerticalAlignment } from './enums';
|
|
6
|
+
export declare class Label extends Control {
|
|
7
|
+
static readonly themeType: string;
|
|
8
|
+
private _text;
|
|
9
|
+
private _horizontalAlignment;
|
|
10
|
+
private _verticalAlignment;
|
|
11
|
+
private _autowrapMode;
|
|
12
|
+
private _textOverflow;
|
|
13
|
+
private layoutDirty;
|
|
14
|
+
private layoutWidth;
|
|
15
|
+
private layout;
|
|
16
|
+
constructor(engine: Engine, text?: string);
|
|
17
|
+
get text(): string;
|
|
18
|
+
set text(value: string);
|
|
19
|
+
get horizontalAlignment(): HorizontalAlignment;
|
|
20
|
+
set horizontalAlignment(value: HorizontalAlignment);
|
|
21
|
+
get verticalAlignment(): VerticalAlignment;
|
|
22
|
+
set verticalAlignment(value: VerticalAlignment);
|
|
23
|
+
get autowrapMode(): AutowrapMode;
|
|
24
|
+
set autowrapMode(value: AutowrapMode);
|
|
25
|
+
get textOverflow(): TextOverflow;
|
|
26
|
+
set textOverflow(value: TextOverflow);
|
|
27
|
+
getMinimumSize(): math.Vector2;
|
|
28
|
+
getDesiredSize(): math.Vector2;
|
|
29
|
+
draw(): void;
|
|
30
|
+
private invalidateTextLayout;
|
|
31
|
+
protected onThemeChanged(affectsLayout: boolean): void;
|
|
32
|
+
private measure;
|
|
33
|
+
private getTextLayout;
|
|
34
|
+
private createNaturalLayout;
|
|
35
|
+
private createLayout;
|
|
36
|
+
private wrapParagraph;
|
|
37
|
+
private findWordEnd;
|
|
38
|
+
private getMinimumLineWidth;
|
|
39
|
+
private getTextStartX;
|
|
40
|
+
private getTextStartY;
|
|
41
|
+
private getVerticalGap;
|
|
42
|
+
private ellipsize;
|
|
43
|
+
private drawFilledLine;
|
|
44
|
+
private drawThemedText;
|
|
45
|
+
fromData(data: LabelData): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine } from '@galacean/effects';
|
|
3
|
+
import type { LineEditData } from '../data';
|
|
4
|
+
import { HorizontalAlignment } from './enums';
|
|
5
|
+
import { TextInput } from './text-input';
|
|
6
|
+
export declare class LineEdit extends TextInput {
|
|
7
|
+
static readonly themeType: string;
|
|
8
|
+
protected readonly multiline = false;
|
|
9
|
+
alignment: HorizontalAlignment;
|
|
10
|
+
private scrollOffset;
|
|
11
|
+
private _secret;
|
|
12
|
+
private _secretCharacter;
|
|
13
|
+
constructor(engine: Engine, text?: string);
|
|
14
|
+
get secret(): boolean;
|
|
15
|
+
set secret(value: boolean);
|
|
16
|
+
get secretCharacter(): string;
|
|
17
|
+
set secretCharacter(value: string);
|
|
18
|
+
getMinimumSize(): math.Vector2;
|
|
19
|
+
getDesiredSize(): math.Vector2;
|
|
20
|
+
draw(): void;
|
|
21
|
+
protected getDisplayText(): string;
|
|
22
|
+
protected getCharacterIndex(position: math.Vector2): number;
|
|
23
|
+
private getVisibleText;
|
|
24
|
+
private measurePrefix;
|
|
25
|
+
private updateScrollOffset;
|
|
26
|
+
private getAlignedTextX;
|
|
27
|
+
fromData(data: LineEditData): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Engine, EventEmitterListener } from '@galacean/effects';
|
|
2
|
+
import type { MenuButtonData, OptionButtonData } from '../data';
|
|
3
|
+
import { Button } from './button';
|
|
4
|
+
import type { ContentInsets } from './button';
|
|
5
|
+
import { ButtonDrawMode } from './enums';
|
|
6
|
+
import type { PopupMenuItemId } from './popup-menu';
|
|
7
|
+
import { PopupMenu } from './popup-menu';
|
|
8
|
+
export declare class MenuButton extends Button {
|
|
9
|
+
static readonly themeType: string;
|
|
10
|
+
readonly popupMenu: PopupMenu;
|
|
11
|
+
private readonly openMenu;
|
|
12
|
+
constructor(engine: Engine, text?: string);
|
|
13
|
+
showPopup(): void;
|
|
14
|
+
onDestroy(): void;
|
|
15
|
+
fromData(data: MenuButtonData): void;
|
|
16
|
+
}
|
|
17
|
+
export type OptionButtonEvent = {
|
|
18
|
+
itemSelected: [id: PopupMenuItemId];
|
|
19
|
+
};
|
|
20
|
+
export declare class OptionButton extends MenuButton {
|
|
21
|
+
static readonly themeType: string;
|
|
22
|
+
private readonly optionEventEmitter;
|
|
23
|
+
private _selected;
|
|
24
|
+
private readonly menuSelected;
|
|
25
|
+
constructor(engine: Engine);
|
|
26
|
+
protected getContentInsets(): ContentInsets;
|
|
27
|
+
protected drawDecoration(mode: ButtonDrawMode): void;
|
|
28
|
+
private getArrowColor;
|
|
29
|
+
get selected(): number;
|
|
30
|
+
set selected(value: number);
|
|
31
|
+
onOption<E extends keyof OptionButtonEvent>(eventName: E, listener: EventEmitterListener<OptionButtonEvent[E]>): void;
|
|
32
|
+
offOption<E extends keyof OptionButtonEvent>(eventName: E, listener: EventEmitterListener<OptionButtonEvent[E]>): void;
|
|
33
|
+
addItem(text: string, id?: PopupMenuItemId): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
select(index: number, signal?: boolean): void;
|
|
36
|
+
selectId(id: PopupMenuItemId, signal?: boolean): void;
|
|
37
|
+
onDestroy(): void;
|
|
38
|
+
fromData(data: OptionButtonData): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { Engine, EventEmitterListener, Texture } from '@galacean/effects';
|
|
3
|
+
import { Control } from '../core/control';
|
|
4
|
+
import type { ControlEvent, Rect } from '../core/control';
|
|
5
|
+
import { AxisStretchMode, Side } from './enums';
|
|
6
|
+
import type { NinePatchRectData } from '../data';
|
|
7
|
+
export type NinePatchRectEvent = ControlEvent & {
|
|
8
|
+
textureChanged: [texture: Texture | null];
|
|
9
|
+
};
|
|
10
|
+
export declare class NinePatchRect extends Control {
|
|
11
|
+
static readonly themeType: string;
|
|
12
|
+
private readonly ninePatchEventEmitter;
|
|
13
|
+
private readonly patchMargins;
|
|
14
|
+
private _texture;
|
|
15
|
+
private _regionRect;
|
|
16
|
+
drawCenter: boolean;
|
|
17
|
+
horizontalAxisStretchMode: AxisStretchMode;
|
|
18
|
+
verticalAxisStretchMode: AxisStretchMode;
|
|
19
|
+
tint: math.Color;
|
|
20
|
+
constructor(engine: Engine, texture?: Texture | null);
|
|
21
|
+
get texture(): Texture | null;
|
|
22
|
+
set texture(value: Texture | null);
|
|
23
|
+
get regionRect(): Rect;
|
|
24
|
+
set regionRect(value: Rect);
|
|
25
|
+
on<E extends keyof NinePatchRectEvent>(eventName: E, listener: EventEmitterListener<NinePatchRectEvent[E]>): void;
|
|
26
|
+
off<E extends keyof NinePatchRectEvent>(eventName: E, listener: EventEmitterListener<NinePatchRectEvent[E]>): void;
|
|
27
|
+
setRegionRect(x: number, y: number, width: number, height: number): void;
|
|
28
|
+
setPatchMargin(side: Side, value: number): void;
|
|
29
|
+
getPatchMargin(side: Side): number;
|
|
30
|
+
getMinimumSize(): math.Vector2;
|
|
31
|
+
getDesiredSize(): math.Vector2;
|
|
32
|
+
draw(): void;
|
|
33
|
+
private getSourceRect;
|
|
34
|
+
fromData(data: NinePatchRectData): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Engine, math } from '@galacean/effects';
|
|
2
|
+
import { Control } from '../core/control';
|
|
3
|
+
export declare class Panel extends Control {
|
|
4
|
+
static readonly themeType: string;
|
|
5
|
+
constructor(engine: Engine);
|
|
6
|
+
draw(): void;
|
|
7
|
+
getMinimumSize(): math.Vector2;
|
|
8
|
+
getDesiredSize(): math.Vector2;
|
|
9
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { math } from '@galacean/effects';
|
|
2
|
+
import type { EventEmitterListener, InputEventKey, InputEventMouseButton, InputEventMouseMotion, Texture } from '@galacean/effects';
|
|
3
|
+
import type { PopupMenuData } from '../data';
|
|
4
|
+
import type { ControlEvent } from '../core/control';
|
|
5
|
+
import { Popup } from './popup';
|
|
6
|
+
export type PopupMenuItemId = number | string;
|
|
7
|
+
export type PopupMenuItem = {
|
|
8
|
+
id: PopupMenuItemId;
|
|
9
|
+
text: string;
|
|
10
|
+
icon?: Texture | null;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
separator?: boolean;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type PopupMenuEvent = ControlEvent & {
|
|
16
|
+
idPressed: [id: PopupMenuItemId];
|
|
17
|
+
};
|
|
18
|
+
export declare class PopupMenu extends Popup {
|
|
19
|
+
static readonly themeType: string;
|
|
20
|
+
private readonly menuEventEmitter;
|
|
21
|
+
private readonly items;
|
|
22
|
+
private hoveredIndex;
|
|
23
|
+
on<E extends keyof PopupMenuEvent>(eventName: E, listener: EventEmitterListener<PopupMenuEvent[E]>): void;
|
|
24
|
+
off<E extends keyof PopupMenuEvent>(eventName: E, listener: EventEmitterListener<PopupMenuEvent[E]>): void;
|
|
25
|
+
addItem(text: string, id?: PopupMenuItemId, icon?: Texture | null): void;
|
|
26
|
+
addSeparator(text?: string): void;
|
|
27
|
+
clear(): void;
|
|
28
|
+
getItemCount(): number;
|
|
29
|
+
getItem(index: number): PopupMenuItem | undefined;
|
|
30
|
+
setItemDisabled(index: number, disabled: boolean): void;
|
|
31
|
+
setItemChecked(index: number, checked: boolean): void;
|
|
32
|
+
getMinimumSize(): math.Vector2;
|
|
33
|
+
getDesiredSize(): math.Vector2;
|
|
34
|
+
draw(): void;
|
|
35
|
+
onMouseMove(event: InputEventMouseMotion): void;
|
|
36
|
+
onMouseLeave(): void;
|
|
37
|
+
onMouseDown(event: InputEventMouseButton): void;
|
|
38
|
+
onKeyDown(event: InputEventKey): void;
|
|
39
|
+
onPopupOpened(): void;
|
|
40
|
+
private getIndexAt;
|
|
41
|
+
private activateIndex;
|
|
42
|
+
private findEnabledIndex;
|
|
43
|
+
fromData(data: PopupMenuData): void;
|
|
44
|
+
}
|