From 82f91d7381bb8ce4cecb653b1d514331d126a40a Mon Sep 17 00:00:00 2001 From: ChiaNing Date: Thu, 5 May 2022 22:34:45 +0800 Subject: [PATCH] graphics api doc param trans (#10939) * graphics api doc param trans * fix --- cocos/2d/components/graphics.ts | 122 +++++++++++++++++++++----------- 1 file changed, 80 insertions(+), 42 deletions(-) diff --git a/cocos/2d/components/graphics.ts b/cocos/2d/components/graphics.ts index 9c4da4b0bf..08ca5cac00 100644 --- a/cocos/2d/components/graphics.ts +++ b/cocos/2d/components/graphics.ts @@ -24,8 +24,6 @@ THE SOFTWARE. */ - - import { ccclass, help, executionOrder, menu, tooltip, type, visible, override, editable, serializable } from 'cc.decorator'; import { builtinResMgr } from '../../core/builtin'; import { InstanceMaterialType, Renderable2D } from '../framework/renderable-2d'; @@ -296,8 +294,10 @@ export class Graphics extends Renderable2D { * @zh * 移动路径起点到坐标(x, y)。 * - * @param x - 移动坐标 x 轴。 - * @param y - 移动坐标 y 轴。 + * @param x @en The x-axis coordinate of the target position. + * @zh 目标位置的 X 轴坐标。 + * @param y @en The y-axis coordinate of the target position. + * @zh 目标位置的 y 轴坐标。 */ public moveTo (x: number, y: number) { if (!this.impl) { @@ -314,8 +314,10 @@ export class Graphics extends Renderable2D { * @zh * 绘制直线路径。 * - * @param x - 绘制路径坐标 x 轴。 - * @param y - 绘制路径坐标 y 轴。 + * @param x @en The x-axis coordinate of the target position. + * @zh 目标位置的 x 轴坐标。 + * @param y @en The x-axis coordinate of the target position. + * @zh 目标位置的 y 轴坐标。 */ public lineTo (x: number, y: number) { if (!this.impl) { @@ -332,12 +334,18 @@ export class Graphics extends Renderable2D { * @zh * 绘制三次贝赛尔曲线路径。 * - * @param c1x - 第一个控制点的坐标 x 轴。 - * @param c1y - 第一个控制点的坐标 y 轴。 - * @param c2x - 第二个控制点的坐标 x 轴。 - * @param c2y - 第二个控制点的坐标 y 轴。 - * @param x - 最后一个控制点的坐标 x 轴。 - * @param y - 最后一个控制点的坐标 y 轴。 + * @param c1x @en The x-axis coordinate of the first control point. + * @zh 第一个控制点的 x 轴坐标。 + * @param c1y @en The y-axis coordinate of the first control point. + * @zh 第一个控制点的 y 轴坐标。 + * @param c2x @en The x-axis coordinate of the second control point. + * @zh 第二个控制点的 x 轴坐标。 + * @param c2y @en The y-axis coordinate of the second control point. + * @zh 第二个控制点的 y 轴坐标。 + * @param x @en The x-axis coordinate of the last control point. + * @zh 最后一个控制点的 x 轴坐标。 + * @param y @en The y-axis coordinate of the last control point. + * @zh 最后一个控制点的 y 轴坐标。 */ public bezierCurveTo (c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number) { if (!this.impl) { @@ -354,10 +362,14 @@ export class Graphics extends Renderable2D { * @zh * 绘制二次贝赛尔曲线路径。 * - * @param cx - 起始控制点的坐标 x 轴。 - * @param cy - 起始控制点的坐标 y 轴。 - * @param x - 终点控制点的坐标 x 轴。 - * @param y - 终点控制点的坐标 x 轴。 + * @param cx @en The x-axis coordinate of the starting control point. + * @zh 起始控制点的 x 轴坐标。 + * @param cy @en The y-axis coordinate of the starting control point. + * @zh 起始控制点的 y 轴坐标。 + * @param x @en The x-axis coordinates of the endpoint control point. + * @zh 终点控制点的 x 轴坐标。 + * @param y @en The y-axis coordinates of the endpoint control point. + * @zh 终点控制点的 x 轴坐标。 */ public quadraticCurveTo (cx: number, cy: number, x: number, y: number) { if (!this.impl) { @@ -375,12 +387,18 @@ export class Graphics extends Renderable2D { * @zh * 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。 * - * @param cx - 中心控制点的坐标 x 轴。 - * @param cy - 中心控制点的坐标 y 轴。 - * @param r - 圆弧弧度。 - * @param startAngle - 开始弧度,从正 x 轴顺时针方向测量。 - * @param endAngle - 结束弧度,从正 x 轴顺时针方向测量。 - * @param counterclockwise 如果为真,在两个角度之间逆时针绘制。默认顺时针。 + * @param cx @en The coordinate x-axis of the central control point. + * @zh 中心控制点的坐标 x 轴。 + * @param cy @en The coordinate y-axis of the central control point. + * @zh 中心控制点的坐标 y 轴。 + * @param r @en Angle in Radian. + * @zh 圆弧弧度。 + * @param startAngle @en The starting angle in radian, measured clockwise from the positive x-axis. + * @zh 弧度起点,从正 x 轴顺时针方向测量。 + * @param endAngle @en The ending angle in radian, measured clockwise from the positive x-axis. + * @zh 弧度终点,从正 x 轴顺时针方向测量。 + * @param counterclockwise @en If true, draws counterclockwise between the two angles. Default is clockwise. + * @zh 如果为真,在两个角度之间逆时针绘制。默认顺时针。 */ public arc (cx: number, cy: number, r: number, startAngle: number, endAngle: number, counterclockwise: boolean) { if (!this.impl) { @@ -397,10 +415,14 @@ export class Graphics extends Renderable2D { * @zh * 绘制椭圆路径。 * - * @param cx - 中心点的坐标 x 轴。 - * @param cy - 中心点的坐标 y 轴。 - * @param rx - 椭圆 x 轴半径。 - * @param ry - 椭圆 y 轴半径。 + * @param cx @en The x-axis coordinates of the center point. + * @zh 中心点的 x 轴坐标。 + * @param cy @en The y-axis coordinates of the center point. + * @zh 中心点的 y 轴坐标。 + * @param rx @en The radius of the x-axis of the ellipse. + * @zh 椭圆 x 轴半径。 + * @param ry @en The radius of the y-axis of the ellipse. + * @zh 椭圆 y 轴半径。 */ public ellipse (cx: number, cy: number, rx: number, ry: number) { if (!this.impl) { @@ -417,9 +439,12 @@ export class Graphics extends Renderable2D { * @zh * 绘制圆形路径。 * - * @param cx - 中心点的坐标 x 轴。 - * @param cy - 中心点的坐标 y 轴。 - * @param r - 圆半径。 + * @param cx @en The x-axis coordinates of the center point. + * @zh 中心点的 x 轴坐标。 + * @param cy @en The y-axis coordinates of the center point. + * @zh 中心点的 y 轴坐标。 + * @param r @en Radius. + * @zh 圆半径。 */ public circle (cx: number, cy: number, r: number) { if (!this.impl) { @@ -436,10 +461,14 @@ export class Graphics extends Renderable2D { * @zh * 绘制矩形路径。 * - * @param x - 矩形起始坐标 x 轴。 - * @param y - 矩形起始坐标 y 轴。 - * @param w - 矩形宽度。 - * @param h - 矩形高度。 + * @param x @en The x-axis coordinate of the top left point of the rectangle. + * @zh 矩形起始 x 轴坐标。 + * @param y @en The y-axis coordinate of the top left point of the rectangle. + * @zh 矩形起始 y 轴坐标。 + * @param w @en The width of the rectangle. + * @zh 矩形宽度。 + * @param h @en The height of the rectangle. + * @zh 矩形高度。 */ public rect (x: number, y: number, w: number, h: number) { if (!this.impl) { @@ -456,11 +485,16 @@ export class Graphics extends Renderable2D { * @zh * 绘制圆角矩形路径。 * - * @param x - 矩形起始坐标 x 轴。 - * @param y - 矩形起始坐标 y 轴。 - * @param w - 矩形宽度。 - * @param h - 矩形高度。 - * @param r - 矩形圆角半径。 + * @param x @en The x-axis coordinate of the top left point of the rectangle. + * @zh 矩形起始 x 轴坐标。 + * @param y @en The y-axis coordinate of the top left point of the rectangle. + * @zh 矩形起始 y 轴坐标。 + * @param w @en The width of the rectangle. + * @zh 矩形宽度。 + * @param h @en The height of the rectangle. + * @zh 矩形高度。 + * @param r @en Radius of rectangular rounded corners. + * @zh 矩形圆角半径。 */ public roundRect (x: number, y: number, w: number, h: number, r: number) { if (!this.impl) { @@ -477,10 +511,14 @@ export class Graphics extends Renderable2D { * @zh * 绘制填充矩形。 * - * @param x - 矩形起始坐标 x 轴。 - * @param y - 矩形起始坐标 y 轴。 - * @param w - 矩形宽度。 - * @param h - 矩形高度。 + * @param x @en The x-axis coordinate of the top left point of the rectangle. + * @zh 矩形起始 x 轴坐标。 + * @param y @en The y-axis coordinate of the top left point of the rectangle. + * @zh 矩形起始 y 轴坐标。 + * @param w @en The width of the rectangle. + * @zh 矩形宽度。 + * @param h @en The height of the rectangle. + * @zh 矩形高度。 */ public fillRect (x, y, w, h) { this.rect(x, y, w, h);