Skip to content

UISKew 组件 在处理 x 轴时, 方向反了 #18952

@finscn

Description

@finscn

Cocos Creator version

3.8.7

System information

all

Issue description

skew 的 x y 为角度.
x 为正数时, 应该是 逆时针斜切. 精灵应该是向左倒.

这个是国际惯例, 也是国际标准.
可以参考 css 的相关处理方式.

transform: skewX(30deg) 时, 矩形区域的上部向左移.

现在 cocos的做法 x 轴是错的 , y轴是对的, y 为正数时, 逆时针斜切.
.这就很尴尬了.
如果两个都是错的, 还可以用 "我们规定 skew 操作中, 角度正方向为顺时针" 来搪塞一下.
现在这种情况 就怎么也解释不清楚了.

究其原因 是这里错了:

Image
        // 这里应该改成这样,  做减法.
        outLocalMatrix.m04 = c - a * skewX;
        outLocalMatrix.m05 = d - b * skewX;

对应的cpp 那边好像也要改

Image

这个 bug 确实很尴尬.
不改, 显得 cocos很不专业, 基础的矩阵计算都算错.
改的话, 现在已经用到的这个组件的人 就要把所有的 skewX 都修改一下...

Relevant error log output

No response

Steps to reproduce

.

Minimal reproduction project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageNeeds to be assigned by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions