From 52e53db2179aed8fce4b4f694e76e2e48f1e03da Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 29 Mar 2017 18:41:32 +0800 Subject: [PATCH] Fix event API doc --- cocos2d/core/event-manager/CCEvent.js | 70 ++++++++++----------------- cocos2d/core/event/event.js | 43 ++++++++++++++-- 2 files changed, 64 insertions(+), 49 deletions(-) diff --git a/cocos2d/core/event-manager/CCEvent.js b/cocos2d/core/event-manager/CCEvent.js index 4d6542772b..eec4c1f30a 100644 --- a/cocos2d/core/event-manager/CCEvent.js +++ b/cocos2d/core/event-manager/CCEvent.js @@ -27,37 +27,6 @@ var JS = cc.js; var Event = cc.Event; -/** - * !#en The type code of Touch event. - * !#zh 触摸事件类型 - * @constant - * @type {String} - */ -cc.Event.TOUCH = 'touch'; -/** - * !#en The type code of Mouse event. - * !#zh 鼠标事件类型 - * @constant - * @type {String} - */ -cc.Event.MOUSE = 'mouse'; -/** - * !#en The type code of Keyboard event. - * !#zh 键盘事件类型 - * @constant - * @memberof cc.Event - * @type {String} - */ -cc.Event.KEYBOARD = 'keyboard'; -/** - * !#en The type code of Acceleration event. - * !#zh 加速器事件类型 - * @constant - * @memberof cc.Event - * @type {String} - */ -cc.Event.ACCELERATION = 'acceleration'; - /** * !#en The mouse event * !#zh 鼠标事件类型 @@ -235,35 +204,40 @@ JS.mixin(EventMouse.prototype, { /** * !#en The none event code of mouse event. * !#zh 无。 - * @constant + * @property NONE + * @static * @type {Number} */ EventMouse.NONE = 0; /** * !#en The event type code of mouse down event. * !#zh 鼠标按下事件。 - * @constant + * @property DOWN + * @static * @type {Number} */ EventMouse.DOWN = 1; /** * !#en The event type code of mouse up event. * !#zh 鼠标按下后释放事件。 - * @constant + * @property UP + * @static * @type {Number} */ EventMouse.UP = 2; /** * !#en The event type code of mouse move event. * !#zh 鼠标移动事件。 - * @constant + * @property MOVE + * @static * @type {Number} */ EventMouse.MOVE = 3; /** * !#en The event type code of mouse scroll event. * !#zh 鼠标滚轮事件。 - * @constant + * @property SCROLL + * @static * @type {Number} */ EventMouse.SCROLL = 4; @@ -271,7 +245,8 @@ EventMouse.SCROLL = 4; /** * !#en The tag of Mouse left button. * !#zh 鼠标左键的标签。 - * @constant + * @property BUTTON_LEFT + * @static * @type {Number} */ EventMouse.BUTTON_LEFT = 0; @@ -279,7 +254,8 @@ EventMouse.BUTTON_LEFT = 0; /** * !#en The tag of Mouse right button (The right button number is 2 on browser). * !#zh 鼠标右键的标签。 - * @constant + * @property BUTTON_RIGHT + * @static * @type {Number} */ EventMouse.BUTTON_RIGHT = 2; @@ -287,7 +263,8 @@ EventMouse.BUTTON_RIGHT = 2; /** * !#en The tag of Mouse middle button (The right button number is 1 on browser). * !#zh 鼠标中键的标签。 - * @constant + * @property BUTTON_MIDDLE + * @static * @type {Number} */ EventMouse.BUTTON_MIDDLE = 1; @@ -295,7 +272,8 @@ EventMouse.BUTTON_MIDDLE = 1; /** * !#en The tag of Mouse button 4. * !#zh 鼠标按键 4 的标签。 - * @constant + * @property BUTTON_4 + * @static * @type {Number} */ EventMouse.BUTTON_4 = 3; @@ -303,7 +281,8 @@ EventMouse.BUTTON_4 = 3; /** * !#en The tag of Mouse button 5. * !#zh 鼠标按键 5 的标签。 - * @constant + * @property BUTTON_5 + * @static * @type {Number} */ EventMouse.BUTTON_5 = 4; @@ -311,7 +290,8 @@ EventMouse.BUTTON_5 = 4; /** * !#en The tag of Mouse button 6. * !#zh 鼠标按键 6 的标签。 - * @constant + * @property BUTTON_6 + * @static * @type {Number} */ EventMouse.BUTTON_6 = 5; @@ -319,7 +299,8 @@ EventMouse.BUTTON_6 = 5; /** * !#en The tag of Mouse button 7. * !#zh 鼠标按键 7 的标签。 - * @constant + * @property BUTTON_7 + * @static * @type {Number} */ EventMouse.BUTTON_7 = 6; @@ -327,7 +308,8 @@ EventMouse.BUTTON_7 = 6; /** * !#en The tag of Mouse button 8. * !#zh 鼠标按键 8 的标签。 - * @constant + * @property BUTTON_8 + * @static * @type {Number} */ EventMouse.BUTTON_8 = 7; diff --git a/cocos2d/core/event/event.js b/cocos2d/core/event/event.js index 6a06499d1c..1382689f4b 100644 --- a/cocos2d/core/event/event.js +++ b/cocos2d/core/event/event.js @@ -192,18 +192,51 @@ cc.Event.prototype = { * !#en Code for event without type. * !#zh 没有类型的事件 * @property NO_TYPE - * @final + * @static * @type {string} */ cc.Event.NO_TYPE = 'no_type'; +/** + * !#en The type code of Touch event. + * !#zh 触摸事件类型 + * @property TOUCH + * @static + * @type {String} + */ +cc.Event.TOUCH = 'touch'; +/** + * !#en The type code of Mouse event. + * !#zh 鼠标事件类型 + * @property MOUSE + * @static + * @type {String} + */ +cc.Event.MOUSE = 'mouse'; +/** + * !#en The type code of Keyboard event. + * !#zh 键盘事件类型 + * @property KEYBOARD + * @static + * @type {String} + */ +cc.Event.KEYBOARD = 'keyboard'; +/** + * !#en The type code of Acceleration event. + * !#zh 加速器事件类型 + * @property ACCELERATION + * @static + * @type {String} + */ +cc.Event.ACCELERATION = 'acceleration'; + //event phase /** * !#en Events not currently dispatched are in this phase * !#zh 尚未派发事件阶段 * @property NONE * @type {Number} - * @final + * @static */ cc.Event.NONE = 0; /** @@ -213,7 +246,7 @@ cc.Event.NONE = 0; * !#zh 捕获阶段,包括事件目标节点之前从根节点到最后一个节点的过程。 * @property CAPTURING_PHASE * @type {Number} - * @final + * @static */ cc.Event.CAPTURING_PHASE = 1; /** @@ -223,7 +256,7 @@ cc.Event.CAPTURING_PHASE = 1; * !#zh 目标阶段仅包括事件目标节点。 * @property AT_TARGET * @type {Number} - * @final + * @static */ cc.Event.AT_TARGET = 2; /** @@ -233,7 +266,7 @@ cc.Event.AT_TARGET = 2; * !#zh 冒泡阶段, 包括回程遇到到层次根节点的任何后续节点。 * @property BUBBLING_PHASE * @type {Number} - * @final + * @static */ cc.Event.BUBBLING_PHASE = 3;