Skip to content

Commit

Permalink
Rename UISkew._value to UISkew._skew.
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar committed Jan 22, 2025
1 parent 0961e17 commit effad1a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cocos/2d/framework/ui-skew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const tempVec2 = v2();
@executeInEditMode
export class UISkew extends Component {
@serializable
private _value: Vec2 = v2();
private _skew: Vec2 = v2();

// FIXME(cjh): I added this property instead of `Component.enabled` since I found that
// When in UISkew.onDisable callback, `this.enabled` may still be true.
Expand All @@ -58,7 +58,7 @@ export class UISkew extends Component {
protected override __preload (): void {
this.node._uiProps._uiSkewComp = this;
if (JSB) {
(this.node as any)._setSkew(this._value);
(this.node as any)._setSkew(this._skew);
}
}

Expand Down Expand Up @@ -94,15 +94,15 @@ export class UISkew extends Component {
* @zh 获取 X 轴斜切角度。
*/
get x (): number {
return this._value.x;
return this._skew.x;
}

/**
* @en Sets the skew on x axis. Unit is degree.
* @zh 设置 X 轴斜切角度。
*/
set x (v: number) {
this._value.x = v;
this._skew.x = v;
if (JSB) {
(this.node as any)._setSkewX(v);
}
Expand All @@ -117,15 +117,15 @@ export class UISkew extends Component {
* @zh 获取 Y 轴斜切角度。
*/
get y (): number {
return this._value.y;
return this._skew.y;
}

/**
* @en Sets the skew on y axis. Unit is degree.
* @zh 设置 Y 轴斜切角度。
*/
set y (v: number) {
this._value.y = v;
this._skew.y = v;
if (JSB) {
(this.node as any)._setSkewY(v);
}
Expand All @@ -141,7 +141,7 @@ export class UISkew extends Component {
*/
@type(Vec2)
get skew (): Readonly<Vec2> {
return this._value;
return this._skew;
}

/**
Expand All @@ -166,7 +166,7 @@ export class UISkew extends Component {
*/
setSkew (x: number, y: number): void;
setSkew (xOrVec2: number | Readonly<IVec2Like>, y?: number): void {
const v = this._value;
const v = this._skew;
if (typeof xOrVec2 === 'number') {
tempVec2.set(xOrVec2, y);
} else {
Expand All @@ -191,7 +191,7 @@ export class UISkew extends Component {
*/
getSkew (out?: Vec2): Vec2 {
if (!out) out = new Vec2();
return out.set(this._value);
return out.set(this._skew);
}

private _updateNodeTransformFlags (): void {
Expand Down

0 comments on commit effad1a

Please sign in to comment.