From 623ef8504149f85db04410f5bd89518de7394286 Mon Sep 17 00:00:00 2001
From: "yufang.wu" <2435731537@qq.com>
Date: Sun, 8 Nov 2020 22:43:51 +0800
Subject: [PATCH] Sync the PR of 2D. (#7730)
* Sync the pr #7262 and #7315 of 2D.
* Commit changes
---
.../platform/event-manager/event-manager.ts | 4 +-
cocos/tween/actions/action-interval.ts | 2 +-
cocos/tween/tween.ts | 2 +-
cocos/ui/components/button.ts | 66 +++++++++++--------
extensions/dragonbones/ArmatureDisplay.js | 8 +--
5 files changed, 46 insertions(+), 36 deletions(-)
diff --git a/cocos/core/platform/event-manager/event-manager.ts b/cocos/core/platform/event-manager/event-manager.ts
index 69da259a94..0514a984b9 100644
--- a/cocos/core/platform/event-manager/event-manager.ts
+++ b/cocos/core/platform/event-manager/event-manager.ts
@@ -1221,14 +1221,14 @@ class EventManager {
/**
* @en
* This class has been deprecated, please use `systemEvent` or `EventTarget` instead.
- * See [Listen to and launch events](../../../manual/en/scripting/events.md) for details.
+ * See [Listen to and launch events](../../../manual/en/scripting/events.html) for details.
*
* `eventManager` is a singleton object which manages event listener subscriptions and event dispatching.
* The EventListener list is managed in such way so that event listeners can be added and removed
* while events are being dispatched.
*
* @zh
- * 该类已废弃,请使用 `systemEvent` 或 `EventTarget` 代替,详见 [监听和发射事件](../../../manual/zh/scripting/events.md)。
+ * 该类已废弃,请使用 `systemEvent` 或 `EventTarget` 代替,详见 [监听和发射事件](../../../manual/zh/scripting/events.html)。
*
* 事件管理器,它主要管理事件监听器注册和派发系统事件。
*
diff --git a/cocos/tween/actions/action-interval.ts b/cocos/tween/actions/action-interval.ts
index f35ed7d459..194c5a5851 100644
--- a/cocos/tween/actions/action-interval.ts
+++ b/cocos/tween/actions/action-interval.ts
@@ -850,7 +850,7 @@ export class Spawn extends ActionInterval {
* @example
* import { spawn, jumpBy, rotateBy, Vec2 } from 'cc';
* const action = spawn(jumpBy(2, new Vec2(300, 0), 50, 4), rotateBy(2, 720));
- * todo:It should be the direct use new
+ * todo: It should be the direct use new
*/
export function spawn (/*Multiple Arguments*/tempArray: any): FiniteTimeAction {
var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
diff --git a/cocos/tween/tween.ts b/cocos/tween/tween.ts
index bd0834b995..7a4f64c056 100644
--- a/cocos/tween/tween.ts
+++ b/cocos/tween/tween.ts
@@ -464,4 +464,4 @@ export function tweenUtil (target?: T) {
warn("tweenUtil' is deprecated, please use 'tween' instead ");
return new Tween(target);
}
-legacyCC.tweenUtil = tweenUtil;
\ No newline at end of file
+legacyCC.tweenUtil = tweenUtil;
diff --git a/cocos/ui/components/button.ts b/cocos/ui/components/button.ts
index 92144316de..da64845e34 100644
--- a/cocos/ui/components/button.ts
+++ b/cocos/ui/components/button.ts
@@ -103,24 +103,33 @@ export enum EventType {
/**
* @en
- * Button has 4 Transition types
- * When Button state changed:
- * If Transition type is Button.Transition.NONE, Button will do nothing
- * If Transition type is Button.Transition.COLOR, Button will change target's color
- * If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite
- * If Transition type is Button.Transition.SCALE, Button will change target node's scale
+ * Button component. Can be pressed or clicked. Button has 4 Transition types:
+ *
+ * - Button.Transition.NONE // Button will do nothing
+ * - Button.Transition.COLOR // Button will change target's color
+ * - Button.Transition.SPRITE // Button will change target Sprite's sprite
+ * - Button.Transition.SCALE // Button will change target node's scale
*
- * Button will trigger 5 events:
- * Button.EVENT_TOUCH_DOWN
- * Button.EVENT_TOUCH_UP
- * Button.EVENT_HOVER_IN
- * Button.EVENT_HOVER_MOVE
- * Button.EVENT_HOVER_OUT
- * User can get the current clicked node with 'event.target' from event object which is passed as parameter in the callback function of click event.
+ * The button can bind events (but you must be on the button's node to bind events).
+ * The following events can be triggered on all platforms.
+ *
+ * - cc.Node.EventType.TOUCH_START // Press
+ * - cc.Node.EventType.TOUCH_MOVE // After pressing and moving
+ * - cc.Node.EventType.TOUCH_END // After pressing and releasing
+ * - cc.Node.EventType.TOUCH_CANCEL // Press to cancel
+ *
+ * The following events are only triggered on the PC platform:
+ *
+ * - cc.Node.EventType.MOUSE_DOWN
+ * - cc.Node.EventType.MOUSE_MOVE
+ * - cc.Node.EventType.MOUSE_ENTER
+ * - cc.Node.EventType.MOUSE_LEAVE
+ * - cc.Node.EventType.MOUSE_UP
+ *
+ * The developer can get the current clicked node with `event.target` from event object which is passed as parameter in the callback function of click event.
*
* @zh
- * 按钮组件。可以被按下,或者点击。
- *
+ * 按钮组件。可以被按下,或者点击。
* 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
*
* - Button.Transition.NONE // 不做任何过渡
@@ -128,7 +137,7 @@ export enum EventType {
* - Button.Transition.SPRITE // 进行精灵之间过渡
* - Button.Transition.SCALE // 进行缩放过渡
*
- * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件):
+ * 按钮可以绑定事件(但是必须要在按钮的 Node 上才能绑定事件)。
* 以下事件可以在全平台上都触发:
*
* - cc.Node.EventType.TOUCH_START // 按下时事件
@@ -143,9 +152,8 @@ export enum EventType {
* - cc.Node.EventType.MOUSE_ENTER // 鼠标进入目标事件
* - cc.Node.EventType.MOUSE_LEAVE // 鼠标离开目标事件
* - cc.Node.EventType.MOUSE_UP // 鼠标松开事件
- * - cc.Node.EventType.MOUSE_WHEEL // 鼠标滚轮事件
*
- * 用户可以通过获取 __点击事件__ 回调函数的参数 event 的 target 属性获取当前点击对象。
+ * 开发者可以通过获取 **点击事件** 回调函数的参数 event 的 target 属性获取当前点击对象。
*
* @example
* ```ts
@@ -155,8 +163,8 @@ export enum EventType {
* log("This is a callback after the trigger event");
* });
* // You could also add a click event
- * //Note: In this way, you can't get the touch event info, so use it wisely.
- * button.node.on('click', (button) => {
+ * // Note: In this way, you can't get the touch event info, so use it wisely.
+ * button.node.on(Node.EventType.CLICK, (button) => {
* //The event is a custom event, you could get the Button component via first argument
* })
* ```
@@ -171,18 +179,20 @@ export class Button extends Component {
/**
* @en
- * Transition target.
+ * Transition target.
* When Button state changed:
- * - If Transition type is Button.Transition.NONE, Button will do nothing.
- * - If Transition type is Button.Transition.COLOR, Button will change target's color.
- * - If Transition type is Button.Transition.SPRITE, Button will change target Sprite's sprite.
+ * - Button.Transition.NONE // Button will do nothing
+ * - Button.Transition.COLOR // Button will change target's color
+ * - Button.Transition.SPRITE // Button will change target Sprite's sprite
+ * - Button.Transition.SCALE // Button will change target node's scale
*
* @zh
* 需要过渡的目标。
- * 当前按钮状态改变规则:
- * - 如果 Transition type 选择 Button.Transition.NONE,按钮不做任何过渡。
- * - 如果 Transition type 选择 Button.Transition.COLOR,按钮会对目标颜色进行颜色之间的过渡。
- * - 如果 Transition type 选择 Button.Transition.Sprite,按钮会对目标 Sprite 进行 Sprite 之间的过渡。
+ * 按钮可以通过修改 Transition 来设置按钮状态过渡的方式:
+ * - Button.Transition.NONE // 不做任何过渡
+ * - Button.Transition.COLOR // 进行颜色之间过渡
+ * - Button.Transition.SPRITE // 进行 Sprite 之间的过渡
+ * - Button.Transition.SCALE // 进行缩放过渡
*/
@type(Node)
@displayOrder(0)
diff --git a/extensions/dragonbones/ArmatureDisplay.js b/extensions/dragonbones/ArmatureDisplay.js
index 82aa983340..27fd4aab04 100644
--- a/extensions/dragonbones/ArmatureDisplay.js
+++ b/extensions/dragonbones/ArmatureDisplay.js
@@ -48,15 +48,15 @@ function setEnumAttr (obj, propName, enumDef) {
* !#en
* The Armature Display of DragonBones
*
- * (Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
+ * Armature Display has a reference to a DragonBonesAsset and stores the state for ArmatureDisplay instance,
* which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible.
- * Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments.)
+ * Multiple Armature Display can use the same DragonBonesAsset which includes all animations, skins, and attachments.
* !#zh
* DragonBones 骨骼动画
*
- * (Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
+ * Armature Display 具有对骨骼数据的引用并且存储了骨骼实例的状态,
* 它由当前的骨骼动作,slot 颜色,和可见的 slot attachments 组成。
- * 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。)
+ * 多个 Armature Display 可以使用相同的骨骼数据,其中包括所有的动画,皮肤和 attachments。
*
* @class ArmatureDisplay
* @extends Component