Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GUI #36

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
2df50f9
feat: ui transform
cptbtptpbcptdtptp Jun 12, 2024
cf0643d
feat: update code
cptbtptpbcptdtptp Jun 17, 2024
22582e1
feat: merge code
cptbtptpbcptdtptp Jun 20, 2024
cdecbc5
feat: udpae code
cptbtptpbcptdtptp Jun 20, 2024
d3599b2
feat: update code
cptbtptpbcptdtptp Jun 20, 2024
9ed8451
feat: merge transform and uitransform
cptbtptpbcptdtptp Jun 26, 2024
ed65e2a
fix: merge code
cptbtptpbcptdtptp Aug 28, 2024
a04790f
fix: merge code
cptbtptpbcptdtptp Aug 28, 2024
ef86b49
feat: update code
cptbtptpbcptdtptp Aug 29, 2024
9a883be
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Aug 30, 2024
0866129
feat: update ui input
cptbtptpbcptdtptp Sep 9, 2024
ff4bdb1
feat: update code
cptbtptpbcptdtptp Sep 19, 2024
75e4c83
feat: ui pointer event
cptbtptpbcptdtptp Sep 25, 2024
e87b7cd
feat: udpate code
cptbtptpbcptdtptp Oct 7, 2024
cc001f1
feat: merge code
cptbtptpbcptdtptp Oct 7, 2024
eea964a
feat: update code
cptbtptpbcptdtptp Oct 10, 2024
05f11da
feat: udpate code
cptbtptpbcptdtptp Oct 10, 2024
6c6be60
feat: udpate code
cptbtptpbcptdtptp Oct 10, 2024
c6cbdee
feat: update code
cptbtptpbcptdtptp Oct 10, 2024
8e70ce9
feat: update code
cptbtptpbcptdtptp Oct 10, 2024
c12b295
feat: update code
cptbtptpbcptdtptp Oct 11, 2024
9d90de5
feat: update code
cptbtptpbcptdtptp Oct 12, 2024
7abc773
feat: update code
cptbtptpbcptdtptp Oct 12, 2024
5c3c47d
feat: update code
cptbtptpbcptdtptp Oct 14, 2024
7f77234
feat: update code
cptbtptpbcptdtptp Oct 14, 2024
48f735c
feat: update code
cptbtptpbcptdtptp Oct 17, 2024
7aa2657
feat: update code
cptbtptpbcptdtptp Oct 20, 2024
0e36499
feat: update code
cptbtptpbcptdtptp Oct 21, 2024
f2158fc
feat: update code
cptbtptpbcptdtptp Oct 22, 2024
685e450
feat: update code
cptbtptpbcptdtptp Oct 22, 2024
45deb33
feat: update code
cptbtptpbcptdtptp Oct 22, 2024
fcb0994
feat: update code
cptbtptpbcptdtptp Oct 22, 2024
b30b2ee
feat: update code
cptbtptpbcptdtptp Oct 22, 2024
85a15fe
feat: merge code
cptbtptpbcptdtptp Oct 23, 2024
af4135d
feat: update code
cptbtptpbcptdtptp Oct 24, 2024
b61b9e7
feat: update code
cptbtptpbcptdtptp Oct 24, 2024
bb145d4
feat: update localbounds
cptbtptpbcptdtptp Oct 24, 2024
74de716
feat: update code
cptbtptpbcptdtptp Oct 27, 2024
49cc82a
feat: merge code
cptbtptpbcptdtptp Oct 27, 2024
c808352
feat: merge code
cptbtptpbcptdtptp Oct 27, 2024
c3c5568
feat: update code
cptbtptpbcptdtptp Oct 29, 2024
b154e57
feat: update ui code
cptbtptpbcptdtptp Nov 1, 2024
951b1a0
feat: udpate code
cptbtptpbcptdtptp Nov 4, 2024
4d930f2
feat: add button
cptbtptpbcptdtptp Nov 5, 2024
72be260
feat: add button
cptbtptpbcptdtptp Nov 5, 2024
c60fa0a
feat: update code
cptbtptpbcptdtptp Nov 5, 2024
f7ffd30
feat: update code
cptbtptpbcptdtptp Nov 5, 2024
7f25dc3
feat: update code
cptbtptpbcptdtptp Nov 6, 2024
c37bee4
feat: merge code
cptbtptpbcptdtptp Nov 6, 2024
a7249b3
feat: update code
cptbtptpbcptdtptp Nov 7, 2024
396656c
feat: update code
cptbtptpbcptdtptp Nov 7, 2024
5fea91f
feat: update code
cptbtptpbcptdtptp Nov 7, 2024
4e66663
feat: update code
cptbtptpbcptdtptp Nov 7, 2024
48d783d
feat: update code
cptbtptpbcptdtptp Nov 7, 2024
3b90739
feat: update code
cptbtptpbcptdtptp Nov 13, 2024
c0cf05a
feat: update code
cptbtptpbcptdtptp Nov 13, 2024
e68d510
feat: update code
cptbtptpbcptdtptp Nov 14, 2024
b385900
feat: update code
cptbtptpbcptdtptp Nov 18, 2024
7ba272c
feat: update code
cptbtptpbcptdtptp Nov 18, 2024
a09efd5
fix: lint error
cptbtptpbcptdtptp Nov 20, 2024
0a0155d
fix: lint error
cptbtptpbcptdtptp Nov 20, 2024
e12ff0b
fix: lint error
cptbtptpbcptdtptp Nov 20, 2024
3bd87bd
fix: lint error
cptbtptpbcptdtptp Nov 20, 2024
2860723
fix: lint error
cptbtptpbcptdtptp Nov 20, 2024
1eab47c
fix: lint error
cptbtptpbcptdtptp Nov 20, 2024
a7b232e
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 4, 2024
7bc504a
fix: udpate ui transform init
cptbtptpbcptdtptp Dec 5, 2024
dea19ce
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 6, 2024
8b8dab9
Merge branch 'feature/ui-init' of https://github.com/singlecoder/engi…
cptbtptpbcptdtptp Dec 12, 2024
0b3218d
feat: update code
cptbtptpbcptdtptp Dec 12, 2024
eb28c10
feat: update code
cptbtptpbcptdtptp Dec 13, 2024
7407f3e
feat: update code
cptbtptpbcptdtptp Dec 16, 2024
59782d3
feat: udpate code
cptbtptpbcptdtptp Dec 16, 2024
9f71641
feat: udpate code
cptbtptpbcptdtptp Dec 16, 2024
4d6b453
feat: update code
cptbtptpbcptdtptp Dec 16, 2024
d552ee8
feat: update code
cptbtptpbcptdtptp Dec 17, 2024
ae510a2
feat: merge code
cptbtptpbcptdtptp Dec 17, 2024
432c465
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 17, 2024
8ece555
feat: update code
cptbtptpbcptdtptp Dec 18, 2024
1eb88b5
feat: merge code
cptbtptpbcptdtptp Dec 18, 2024
1caa84d
feat: udpate code
cptbtptpbcptdtptp Dec 18, 2024
8527942
feat: update code
cptbtptpbcptdtptp Dec 19, 2024
4d3ae40
feat: update code
cptbtptpbcptdtptp Dec 23, 2024
7fb40e8
fix: merge code
cptbtptpbcptdtptp Dec 23, 2024
29446a9
feat: merge code
cptbtptpbcptdtptp Dec 24, 2024
6570a06
feat: merge code
cptbtptpbcptdtptp Dec 24, 2024
25e165d
feat: udpate code
cptbtptpbcptdtptp Dec 24, 2024
9254641
feat: udpate code
cptbtptpbcptdtptp Dec 24, 2024
1556d94
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 24, 2024
73662a9
feat: udpate code
cptbtptpbcptdtptp Dec 25, 2024
f85da64
feat: udpate code
cptbtptpbcptdtptp Dec 25, 2024
fcc7813
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 25, 2024
7137967
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 30, 2024
a31cd4e
feat: udpate code
cptbtptpbcptdtptp Dec 30, 2024
d4ce2dd
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 31, 2024
1ee2cc4
feat: udpate code
cptbtptpbcptdtptp Dec 31, 2024
026b219
feat: udpate code
cptbtptpbcptdtptp Dec 31, 2024
1719b32
feat: udpate code
cptbtptpbcptdtptp Dec 31, 2024
9de9ea5
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 31, 2024
0cf2a1f
feat: update code
cptbtptpbcptdtptp Dec 31, 2024
e465050
Merge remote-tracking branch 'ck/feature/ui-init' into feature/ui-init
cptbtptpbcptdtptp Dec 31, 2024
88d73f3
feat: update code
cptbtptpbcptdtptp Dec 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/core/src/2d/assembler/ISpriteAssembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export interface ISpriteAssembler {
height: number,
pivot: Vector2,
flipX?: boolean,
flipY?: boolean,
pixelsPerUnit?: number
flipY?: boolean
): void;
updateUVs(renderer: ISpriteRenderer): void;
updateColor(renderer: ISpriteRenderer, alpha?: number): void;
Expand Down
8 changes: 3 additions & 5 deletions packages/core/src/2d/assembler/SlicedSpriteAssembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ export class SlicedSpriteAssembler {
height: number,
pivot: Vector2,
flipX: boolean = false,
flipY: boolean = false,
pixelsPerUnit: number = 1
flipY: boolean = false
): void {
const { sprite } = renderer;
const { border } = sprite;
// Update local positions.
const spritePositions = sprite._getPositions();
const { x: left, y: bottom } = spritePositions[0];
const { x: right, y: top } = spritePositions[3];
const pixelsPerUnitReciprocal = 1 / pixelsPerUnit;
const expectWidth = sprite.width * pixelsPerUnitReciprocal;
const expectHeight = sprite.height * pixelsPerUnitReciprocal;
const expectWidth = sprite.width;
const expectHeight = sprite.height;
const fixedLeft = expectWidth * border.x;
const fixedBottom = expectHeight * border.y;
const fixedRight = expectWidth * border.z;
Expand Down
12 changes: 5 additions & 7 deletions packages/core/src/2d/assembler/TiledSpriteAssembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ export class TiledSpriteAssembler {
height: number,
pivot: Vector2,
flipX: boolean = false,
flipY: boolean = false,
pixelsPerUnit: number = 1
flipY: boolean = false
): void {
// Calculate row and column
const { _posRow: rPos, _posColumn: cPos, _uvRow: rUV, _uvColumn: cUV } = TiledSpriteAssembler;
TiledSpriteAssembler.resetData(
renderer,
TiledSpriteAssembler._calculateDividing(renderer, width, height, rPos, cPos, rUV, cUV, 1 / pixelsPerUnit)
TiledSpriteAssembler._calculateDividing(renderer, width, height, rPos, cPos, rUV, cUV)
);
// Update renderer's worldMatrix
const { x: pivotX, y: pivotY } = pivot;
Expand Down Expand Up @@ -173,8 +172,7 @@ export class TiledSpriteAssembler {
rPos: DisorderedArray<number>,
cPos: DisorderedArray<number>,
rUV: DisorderedArray<number>,
cUV: DisorderedArray<number>,
pixelsPerUnitReciprocal: number = 1
cUV: DisorderedArray<number>
): number {
rPos.length = cPos.length = rUV.length = cUV.length = 0;
const { sprite, tiledAdaptiveThreshold: threshold } = renderer;
Expand All @@ -183,8 +181,8 @@ export class TiledSpriteAssembler {
const { x: left, y: bottom } = spritePositions[0];
const { x: right, y: top } = spritePositions[3];
const [spriteUV0, spriteUV1, spriteUV2, spriteUV3] = sprite._getUVs();
const expectWidth = sprite.width * pixelsPerUnitReciprocal;
const expectHeight = sprite.height * pixelsPerUnitReciprocal;
const expectWidth = sprite.width;
const expectHeight = sprite.height;
const fixedL = expectWidth * border.x;
const fixedR = expectWidth * border.z;
const fixedLR = fixedL + fixedR;
Expand Down
9 changes: 7 additions & 2 deletions packages/core/src/2d/sprite/Sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,15 @@ export class Sprite extends ReferResource {
private _calDefaultSize(): void {
if (this._texture) {
const { _texture, _atlasRegion, _atlasRegionOffset, _region } = this;
const pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
this._automaticWidth =
((_texture.width * _atlasRegion.width) / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z)) * _region.width;
((_texture.width * _atlasRegion.width) / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z)) *
_region.width *
pixelsPerUnitReciprocal;
this._automaticHeight =
((_texture.height * _atlasRegion.height) / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w)) * _region.height;
((_texture.height * _atlasRegion.height) / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w)) *
_region.height *
pixelsPerUnitReciprocal;
} else {
this._automaticWidth = this._automaticHeight = 0;
}
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/2d/sprite/SpriteMask.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BoundingBox } from "@galacean/engine-math";
import { Engine } from "../../Engine";
import { Entity } from "../../Entity";
import { RenderQueueFlags } from "../../RenderPipeline/BasicRenderPipeline";
import { BatchUtils } from "../../RenderPipeline/BatchUtils";
Expand Down Expand Up @@ -329,9 +328,8 @@ export class SpriteMask extends Renderer implements ISpriteRenderer {
private _calDefaultSize(): void {
const sprite = this._sprite;
if (sprite) {
const pixelsPerUnitReciprocal = 1 / Engine._pixelsPerUnit;
this._automaticWidth = sprite.width * pixelsPerUnitReciprocal;
this._automaticHeight = sprite.height * pixelsPerUnitReciprocal;
this._automaticWidth = sprite.width;
this._automaticHeight = sprite.height;
} else {
this._automaticWidth = this._automaticHeight = 0;
}
Expand Down
9 changes: 3 additions & 6 deletions packages/core/src/2d/sprite/SpriteRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BoundingBox, Color, MathUtil } from "@galacean/engine-math";
import { Engine } from "../../Engine";
import { Entity } from "../../Entity";
import { BatchUtils } from "../../RenderPipeline/BatchUtils";
import { PrimitiveChunkManager } from "../../RenderPipeline/PrimitiveChunkManager";
Expand Down Expand Up @@ -354,8 +353,7 @@ export class SpriteRenderer extends Renderer implements ISpriteRenderer {
this.height,
sprite.pivot,
this._flipX,
this._flipY,
Engine._pixelsPerUnit
this._flipY
);
this._dirtyUpdateFlag &= ~SpriteRendererUpdateFlags.Position;
}
Expand Down Expand Up @@ -404,9 +402,8 @@ export class SpriteRenderer extends Renderer implements ISpriteRenderer {
private _calDefaultSize(): void {
const sprite = this._sprite;
if (sprite) {
const pixelsPerUnitReciprocal = 1 / Engine._pixelsPerUnit;
this._automaticWidth = sprite.width * pixelsPerUnitReciprocal;
this._automaticHeight = sprite.height * pixelsPerUnitReciprocal;
this._automaticWidth = sprite.width;
this._automaticHeight = sprite.height;
} else {
this._automaticWidth = this._automaticHeight = 0;
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/2d/text/ITextRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import { SubFont } from "./SubFont";
export interface ITextRenderer {
text: string;
overflowMode: OverflowMode;
lineSpacing: number;
_getSubFont(): SubFont;
}
2 changes: 1 addition & 1 deletion packages/ui/src/component/UICanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class UICanvas extends Component implements IElement {
@ignoreClone
private _distance: number = 10;
@deepClone
private _referenceResolution: Vector2 = new Vector2(800, 600);
private _referenceResolution: Vector2 = new Vector2(8, 6);
@ignoreClone
private _hierarchyVersion: number = -1;

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/component/UITransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Entity, Transform, Vector2, deepClone, ignoreClone } from "@galacean/en
*/
export class UITransform extends Transform {
@deepClone
private _size: Vector2 = new Vector2(100, 100);
private _size: Vector2 = new Vector2(1, 1);
@deepClone
private _pivot: Vector2 = new Vector2(0.5, 0.5);

Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/component/advanced/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
SpriteModifyFlags,
SpriteTileMode,
TiledSpriteAssembler,
Vector2,
assignmentClone,
ignoreClone
} from "@galacean/engine";
Expand Down
27 changes: 19 additions & 8 deletions packages/ui/src/component/advanced/Label.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
BoundingBox,
CharRenderInfo,
Engine,
Entity,
Font,
FontStyle,
Expand Down Expand Up @@ -414,17 +415,24 @@ export class Label extends UIRenderer implements ITextRenderer {
}

private _updateLocalData(): void {
// @ts-ignore
const pixelsPerUnit = Engine._pixelsPerUnit;
const { min, max } = this._localBounds;
const charRenderInfos = Label._charRenderInfos;
const charFont = this._getSubFont();
const { size, pivot } = <UITransform>this._transformEntity.transform;
const rendererWidth = size.x;
const rendererHeight = size.y;
let rendererWidth = size.x;
let rendererHeight = size.y;
const offsetWidth = rendererWidth * (0.5 - pivot.x);
const offsetHeight = rendererHeight * (0.5 - pivot.y);
const textMetrics = this.enableWrapping
? TextUtils.measureTextWithWrap(this, rendererWidth, rendererHeight, this._lineSpacing)
: TextUtils.measureTextWithoutWrap(this, rendererHeight, this._lineSpacing);
? TextUtils.measureTextWithWrap(
this,
rendererWidth * pixelsPerUnit,
rendererHeight * pixelsPerUnit,
this._lineSpacing * pixelsPerUnit
)
: TextUtils.measureTextWithoutWrap(this, rendererHeight * pixelsPerUnit, this._lineSpacing * pixelsPerUnit);
const { height, lines, lineWidths, lineHeight, lineMaxSizes } = textMetrics;
// @ts-ignore
const charRenderInfoPool = this.engine._charRenderInfoPool;
Expand All @@ -433,6 +441,9 @@ export class Label extends UIRenderer implements ITextRenderer {

if (linesLen > 0) {
const { horizontalAlignment } = this;
const pixelsPerUnitReciprocal = 1.0 / pixelsPerUnit;
rendererWidth *= pixelsPerUnit;
rendererHeight *= pixelsPerUnit;
const halfRendererWidth = rendererWidth * 0.5;
const halfLineHeight = lineHeight * 0.5;

Expand Down Expand Up @@ -486,10 +497,10 @@ export class Label extends UIRenderer implements ITextRenderer {
charRenderInfo.texture = charFont._getTextureByIndex(charInfo.index);
charRenderInfo.uvs = charInfo.uvs;
const { w, ascent, descent } = charInfo;
const left = startX + offsetWidth;
const right = startX + w + offsetWidth;
const top = startY + ascent + offsetHeight;
const bottom = startY - descent + offsetHeight;
const left = (startX + offsetWidth) * pixelsPerUnitReciprocal;
const right = (startX + w + offsetWidth) * pixelsPerUnitReciprocal;
const top = (startY + ascent + offsetHeight) * pixelsPerUnitReciprocal;
const bottom = (startY - descent + offsetHeight) * pixelsPerUnitReciprocal;
localPositions.set(left, top, right, bottom);
i === firstLine && (maxY = Math.max(maxY, top));
minY = Math.min(minY, bottom);
Expand Down
77 changes: 33 additions & 44 deletions packages/ui/src/component/interactive/UIInteractive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export class UIInteractive extends Script implements IGroupAble {
private _isPointerInside: boolean = false;
private _isPointerDragging: boolean = false;

/**
* The transitions of this interactive.
*/
get transitions(): Readonly<Transition[]> {
return this._transitions;
}

/**
* Whether the interactive is enabled.
*/
Expand Down Expand Up @@ -83,48 +90,45 @@ export class UIInteractive extends Script implements IGroupAble {
}

/**
* Get transition which match the type.
* @param type - The type of the transition
* @returns Transitions which match type
* Add transition on this interactive.
* @param transition - The transition
*/
getTransitions<T extends Transition>(type: new (interactive: UIInteractive) => T, results: T[]): T[] {
results.length = 0;
const transitions = this._transitions;
for (let i = 0, n = transitions.length; i < n; i++) {
const transition = transitions[i];
if (transition instanceof type) {
results.push(transition);
}
addTransition(transition: Transition): void {
const interactive = transition._interactive;
if (interactive !== this) {
interactive?.removeTransition(transition);
this._transitions.push(transition);
transition._interactive = this;
transition._setState(this._state, true);
}
return results;
}

/**
* Get transition which match the type.
* @param type - The type of the transition
* @returns The first transition which match type
* Remove a transition.
* @param shape - The transition.
*/
getTransition<T extends Transition>(type: new (interactive: UIInteractive) => T): T | null {
removeTransition(transition: Transition): void {
const transitions = this._transitions;
for (let i = 0, n = transitions.length; i < n; i++) {
const transition = transitions[i];
if (transition instanceof type) {
return transition;
const lastOneIndex = transitions.length - 1;
for (let i = lastOneIndex; i >= 0; i--) {
if (transitions[i] === transition) {
i !== lastOneIndex && (transitions[i] = transitions[lastOneIndex]);
transitions.length = lastOneIndex;
transition._interactive = null;
break;
}
}
return null;
}

/**
* Add transition based on the transition type.
* @param type - The type of the transition
* @returns The transition which has been added
* Remove all transitions.
*/
addTransition<T extends new (interactive: UIInteractive) => Transition>(type: T): InstanceType<T> {
const transition = new type(this) as InstanceType<T>;
this._transitions.push(transition);
transition._setState(this._state, true);
return transition;
clearShapes(): void {
const transitions = this._transitions;
for (let i = 0, n = transitions.length; i < n; i++) {
transitions[i]._interactive = null;
}
transitions.length = 0;
}

override onUpdate(deltaTime: number): void {
Expand Down Expand Up @@ -198,21 +202,6 @@ export class UIInteractive extends Script implements IGroupAble {
this._isPointerInside = this._isPointerDragging = false;
}

/**
* @internal
*/
_removeTransition(transition: Transition): void {
const transitions = this._transitions;
const lastOneIndex = transitions.length - 1;
for (let i = lastOneIndex; i >= 0; i--) {
if (transitions[i] === transition) {
i !== lastOneIndex && (transitions[i] = transitions[lastOneIndex]);
transitions.length = lastOneIndex;
break;
}
}
}

/**
* @internal
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Color } from "@galacean/engine";
import { UIRenderer } from "../../UIRenderer";
import { InteractiveState } from "../UIInteractive";
import { Transition } from "./Transition";
import { InteractiveState, UIInteractive } from "../UIInteractive";

/**
* Color transition.
*/
export class ColorTransition extends Transition<Color, UIRenderer> {
private _color: Color = new Color();
constructor(interactive: UIInteractive) {
super(interactive);
constructor() {
super();
this._normal = new Color(1, 1, 1, 1);
this._hover = new Color(245 / 255, 245 / 255, 245 / 255, 1);
this._pressed = new Color(200 / 255, 200 / 255, 200 / 255, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { UIRenderer } from "../../UIRenderer";
import { UIInteractive } from "../UIInteractive";
import { Transition } from "./Transition";

/**
* Scale transition.
*/
export class ScaleTransition extends Transition<number, UIRenderer> {
constructor(interactive: UIInteractive) {
super(interactive);
constructor() {
super();
this._normal = 1;
this._hover = 1;
this._pressed = 1.2;
Expand Down
Loading
Loading