diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js
index 2aadbaaa9b..b4c4f1f005 100644
--- a/cocos2d/core/CCDirector.js
+++ b/cocos2d/core/CCDirector.js
@@ -242,7 +242,7 @@ cc.Director.prototype = {
var top = box.top + window.pageYOffset - container.clientTop;
var x = view._devicePixelRatio * (uiPoint.x - left);
var y = view._devicePixelRatio * (top + box.height - uiPoint.y);
- return view._isRotated ? {x: view._viewportRect.width - y, y: x} : {x: x, y: y};
+ return view._isRotated ? cc.v2(view._viewportRect.width - y, x) : cc.v2(x, y);
},
/**
@@ -262,7 +262,7 @@ cc.Director.prototype = {
var box = container.getBoundingClientRect();
var left = box.left + window.pageXOffset - container.clientLeft;
var top = box.top + window.pageYOffset - container.clientTop;
- var uiPoint = {x: 0, y: 0};
+ var uiPoint = cc.v2(0, 0);
if (view._isRotated) {
uiPoint.x = left + glPoint.y / view._devicePixelRatio;
uiPoint.y = top + box.height - (view._viewportRect.width - glPoint.x) / view._devicePixelRatio;
diff --git a/cocos2d/core/CCGame.js b/cocos2d/core/CCGame.js
index 1e56d7e00b..bf6bb1cb4e 100644
--- a/cocos2d/core/CCGame.js
+++ b/cocos2d/core/CCGame.js
@@ -610,7 +610,7 @@ var game = {
if (typeof config.registerSystemEvent !== 'boolean') {
config.registerSystemEvent = true;
}
- config.showFPS = (typeof config.showFPS !== 'undefined') ? (!!config.showFPS) : true;
+ config.showFPS = !!config.showFPS;
// Scene parser
this._sceneInfos = config.scenes || [];
diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js
index 538f7974c2..210d310ef5 100644
--- a/cocos2d/core/CCNode.js
+++ b/cocos2d/core/CCNode.js
@@ -47,6 +47,8 @@ const ONE_DEGREE = Math.PI / 180;
var ActionManagerExist = !!cc.ActionManager;
var emptyFunc = function () {};
+var _vec2a = cc.v2();
+var _vec2b = cc.v2();
var _mat4_temp = math.mat4.create();
var _vec3_temp = math.vec3.create();
var _quat_temp = math.quat.create();
@@ -122,7 +124,7 @@ var LocalDirtyFlag = cc.Enum({
/**
* !#en The event type supported by Node
* !#zh Node 支持的事件类型
- * @enum Node.EventType
+ * @class Node.EventType
* @static
* @namespace Node
*/
@@ -709,9 +711,6 @@ var Node = cc.Class({
*/
rotation: {
get () {
- if (this._rotationX !== this._rotationY) {
- cc.logID(1602);
- }
return this._rotationX;
},
set (value) {
@@ -1339,54 +1338,7 @@ var Node = cc.Class({
// EVENT TARGET
- /**
- * !#en
- * Register a callback of a specific event type on Node.
- * Use this method to register touch or mouse event permit propagation based on scene graph,
- * These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:
- * 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target
- * 2. At target phase: dispatch to the listeners of the real target
- * 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root
- * In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.
- * It's the recommended way to register touch/mouse event for Node,
- * please do not use cc.eventManager directly for Node.
- * You can also register custom event and use `emit` to trigger custom event on Node.
- * For such events, there won't be capturing and bubbling phase, your event will be dispatched directly to its listeners registered on the same node.
- * You can also pass event callback parameters with `emit` by passing parameters after `type`.
- * !#zh
- * 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。
- * 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:
- * 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。
- * 2. 目标阶段:派发给目标节点的监听器。
- * 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发知道根节点。
- * 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。
- * 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。
- * 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器
- * 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
- * @method on
- * @param {String} type - A string representing the event type to listen for.
- * See {{#crossLink "Node/EventTyupe/POSITION_CHANGED"}}Node Events{{/crossLink}} for all builtin events.
- * @param {Function} callback - The callback that will be invoked when the event is dispatched.
- * The callback is ignored if it is a duplicate (the callbacks are unique).
- * @param {Event} callback.event event
- * @param {Object} [target] - The target (this object) to invoke the callback, can be null
- * @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback
- * from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
- * When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
- * Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
- * @return {Function} - Just returns the incoming callback so you can save the anonymous function easier.
- * @typescript
- * on(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void
- * on(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void
- * @example
- * this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
- * node.on(cc.Node.EventType.TOUCH_START, callback, this.node);
- * node.on(cc.Node.EventType.TOUCH_MOVE, callback, this.node);
- * node.on(cc.Node.EventType.TOUCH_END, callback, this.node);
- * node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this.node);
- * node.on(cc.Node.EventType.ANCHOR_CHANGED, callback, this);
- */
- on (type, callback, target, useCapture) {
+ _checknSetupSysEvent (type) {
let newAdded = false;
let forDispatch = false;
if (_touchEvents.indexOf(type) !== -1) {
@@ -1430,7 +1382,61 @@ var Node = cc.Class({
}
}, this, 0, 0, 0, false);
}
+ return forDispatch;
+ },
+ /**
+ * !#en
+ * Register a callback of a specific event type on Node.
+ * Use this method to register touch or mouse event permit propagation based on scene graph,
+ * These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:
+ * 1. Capturing phase: dispatch in capture targets (`_getCapturingTargets`), e.g. parents in node tree, from root to the real target
+ * 2. At target phase: dispatch to the listeners of the real target
+ * 3. Bubbling phase: dispatch in bubble targets (`_getBubblingTargets`), e.g. parents in node tree, from the real target to root
+ * In any moment of the dispatching process, it can be stopped via `event.stopPropagation()` or `event.stopPropagationImmidiate()`.
+ * It's the recommended way to register touch/mouse event for Node,
+ * please do not use cc.eventManager directly for Node.
+ * You can also register custom event and use `emit` to trigger custom event on Node.
+ * For such events, there won't be capturing and bubbling phase, your event will be dispatched directly to its listeners registered on the same node.
+ * You can also pass event callback parameters with `emit` by passing parameters after `type`.
+ * !#zh
+ * 在节点上注册指定类型的回调函数,也可以设置 target 用于绑定响应函数的 this 对象。
+ * 鼠标或触摸事件会被系统调用 dispatchEvent 方法触发,触发的过程包含三个阶段:
+ * 1. 捕获阶段:派发事件给捕获目标(通过 `_getCapturingTargets` 获取),比如,节点树中注册了捕获阶段的父节点,从根节点开始派发直到目标节点。
+ * 2. 目标阶段:派发给目标节点的监听器。
+ * 3. 冒泡阶段:派发事件给冒泡目标(通过 `_getBubblingTargets` 获取),比如,节点树中注册了冒泡阶段的父节点,从目标节点开始派发知道根节点。
+ * 同时您可以将事件派发到父节点或者通过调用 stopPropagation 拦截它。
+ * 推荐使用这种方式来监听节点上的触摸或鼠标事件,请不要在节点上直接使用 cc.eventManager。
+ * 你也可以注册自定义事件到节点上,并通过 emit 方法触发此类事件,对于这类事件,不会发生捕获冒泡阶段,只会直接派发给注册在该节点上的监听器
+ * 你可以通过在 emit 方法调用时在 type 之后传递额外的参数作为事件回调的参数列表
+ * @method on
+ * @param {String|Node.EventType} type - A string representing the event type to listen for.
+ * See {{#crossLink "Node/EventTyupe/POSITION_CHANGED"}}Node Events{{/crossLink}} for all builtin events.
+ * @param {Function} callback - The callback that will be invoked when the event is dispatched.
+ * The callback is ignored if it is a duplicate (the callbacks are unique).
+ * @param {Event|Object} callback.event event or first argument when emit
+ * @param {Event} callback.arg2 arg2
+ * @param {Event} callback.arg3 arg3
+ * @param {Event} callback.arg4 arg4
+ * @param {Event} callback.arg5 arg5
+ * @param {Object} [target] - The target (this object) to invoke the callback, can be null
+ * @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback
+ * from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
+ * When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE.
+ * Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET.
+ * @return {Function} - Just returns the incoming callback so you can save the anonymous function easier.
+ * @typescript
+ * on(type: string, callback: T, target?: any, useCapture?: boolean): T
+ * @example
+ * this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass.
+ * node.on(cc.Node.EventType.TOUCH_START, callback, this);
+ * node.on(cc.Node.EventType.TOUCH_MOVE, callback, this);
+ * node.on(cc.Node.EventType.TOUCH_END, callback, this);
+ * node.on(cc.Node.EventType.TOUCH_CANCEL, callback, this);
+ * node.on(cc.Node.EventType.ANCHOR_CHANGED, callback);
+ */
+ on (type, callback, target, useCapture) {
+ let forDispatch = this._checknSetupSysEvent(type);
if (forDispatch) {
return this._onDispatch(type, callback, target, useCapture);
}
@@ -1459,6 +1465,53 @@ var Node = cc.Class({
}
},
+ /**
+ * !#en
+ * Register an callback of a specific event type on the Node,
+ * the callback will remove itself after the first time it is triggered.
+ * !#zh
+ * 注册节点的特定事件类型回调,回调会在第一时间被触发后删除自身。
+ *
+ * @method once
+ * @param {String} type - A string representing the event type to listen for.
+ * @param {Function} callback - The callback that will be invoked when the event is dispatched.
+ * The callback is ignored if it is a duplicate (the callbacks are unique).
+ * @param {Event} callback.event event or first argument when emit
+ * @param {Event} callback.arg2 arg2
+ * @param {Event} callback.arg3 arg3
+ * @param {Event} callback.arg4 arg4
+ * @param {Event} callback.arg5 arg5
+ * @param {Object} [target] - The target (this object) to invoke the callback, can be null
+ * @typescript
+ * once(type: string, callback: T, target?: any, useCapture?: boolean): T
+ * @example
+ * node.once(cc.Node.EventType.ANCHOR_CHANGED, callback);
+ */
+ once (type, callback, target, useCapture) {
+ let forDispatch = this._checknSetupSysEvent(type);
+ let eventType_hasOnceListener = '__ONCE_FLAG:' + type;
+
+ let listeners = null;
+ if (forDispatch && useCapture) {
+ listeners = this._capturingListeners = this._capturingListeners || new EventTarget();
+ }
+ else {
+ listeners = this._bubblingListeners = this._bubblingListeners || new EventTarget();
+ }
+
+ let hasOnceListener = listeners.hasEventListener(eventType_hasOnceListener, callback, target);
+ if (!hasOnceListener) {
+ let self = this;
+ let onceWrapper = function (arg1, arg2, arg3, arg4, arg5) {
+ self.off(type, onceWrapper, target);
+ listeners.remove(eventType_hasOnceListener, callback, target);
+ callback.call(this, arg1, arg2, arg3, arg4, arg5);
+ };
+ this.on(type, onceWrapper, target);
+ listeners.add(eventType_hasOnceListener, callback, target);
+ }
+ },
+
_onDispatch (type, callback, target, useCapture) {
// Accept also patameters like: (type, callback, useCapture)
if (typeof target === 'boolean') {
@@ -1489,26 +1542,6 @@ var Node = cc.Class({
return callback;
},
- _onceDispatch (type, callback, target, useCapture) {
- var eventType_hasOnceListener = '__ONCE_FLAG:' + type;
- var listeners = useCapture ? this._capturingListeners : this._bubblingListeners;
- var hasOnceListener = listeners && listeners.hasEventListener(eventType_hasOnceListener, callback, target);
- if (!hasOnceListener) {
- var self = this;
- var onceWrapper = function (event) {
- self._offDispatch(type, onceWrapper, target, useCapture);
- listeners.remove(eventType_hasOnceListener, callback, target);
- callback.call(this, event);
- };
- this._onDispatch(type, onceWrapper, target, useCapture);
- if (!listeners) {
- // obtain new created listeners
- listeners = useCapture ? this._capturingListeners : this._bubblingListeners;
- }
- listeners.add(eventType_hasOnceListener, callback, target);
- }
- },
-
/**
* !#en
* Removes the callback previously registered with the same type, callback, target and or useCapture.
@@ -1730,23 +1763,24 @@ var Node = cc.Class({
},
_hitTest (point, listener) {
- var w = this.width,
- h = this.height;
- var testPt;
+ let w = this._contentSize.width,
+ h = this._contentSize.height,
+ cameraPt = _vec2a,
+ testPt = _vec2b;
let camera = cc.Camera.findCamera(this);
if (camera) {
- testPt = camera.getCameraToWorldPoint(point);
+ camera.getCameraToWorldPoint(point, cameraPt);
}
else {
- testPt = cc.v2(point);
+ cameraPt.set(point);
}
this._updateWorldMatrix();
math.mat4.invert(_mat4_temp, this._worldMatrix);
- math.vec2.transformMat4(testPt, testPt, _mat4_temp);
- testPt.x += this._anchorPoint.x * this._contentSize.width;
- testPt.y += this._anchorPoint.y * this._contentSize.height;
+ math.vec2.transformMat4(testPt, cameraPt, _mat4_temp);
+ testPt.x += this._anchorPoint.x * w;
+ testPt.y += this._anchorPoint.y * h;
if (testPt.x >= 0 && testPt.y >= 0 && testPt.x <= w && testPt.y <= h) {
if (listener && listener.mask) {
@@ -1757,7 +1791,7 @@ var Node = cc.Class({
// find mask parent, should hit test it
if (parent === mask.node) {
var comp = parent.getComponent(cc.Mask);
- return (comp && comp.enabledInHierarchy) ? comp._hitTest(point) : true;
+ return (comp && comp.enabledInHierarchy) ? comp._hitTest(cameraPt) : true;
}
// mask parent no longer exists
else {
@@ -2368,7 +2402,7 @@ var Node = cc.Class({
let t = this._matrix;
//math.mat4.fromRTS(t, this._quat, this._position, this._scale);
- if (dirtyFlag & LocalDirtyFlag.RT) {
+ if (dirtyFlag & (LocalDirtyFlag.RT | LocalDirtyFlag.SKEW)) {
let hasRotation = this._rotationX || this._rotationY;
let hasSkew = this._skewX || this._skewY;
let sx = this._scale.x, sy = this._scale.y;
diff --git a/cocos2d/core/assets/CCSpriteFrame.js b/cocos2d/core/assets/CCSpriteFrame.js
index cb573a6d0d..91ed35c7f8 100644
--- a/cocos2d/core/assets/CCSpriteFrame.js
+++ b/cocos2d/core/assets/CCSpriteFrame.js
@@ -102,6 +102,9 @@ let SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
* @param {Size} [originalSize] - The size of the frame in the texture
*/
ctor: function () {
+ // Init EventTarget data
+ EventTarget.call(this);
+
let filename = arguments[0];
let rect = arguments[1];
let rotated = arguments[2];
diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js
index 55b6741eff..d110f4e85e 100644
--- a/cocos2d/core/components/CCAnimation.js
+++ b/cocos2d/core/components/CCAnimation.js
@@ -37,6 +37,58 @@ function equalClips (clip1, clip2) {
return clip1 && clip2 && (clip1.name === clip2.name || clip1._uuid === clip2._uuid);
}
+/**
+ * !#en The event type supported by Animation
+ * !#zh Animation 支持的事件类型
+ * @class Animation.EventType
+ * @static
+ * @namespace Animationd
+ */
+var EventType = cc.Enum({
+ /**
+ * !#en Emit when begin playing animation
+ * !#zh 开始播放时触发
+ * @property {String} PLAY
+ * @static
+ */
+ PLAY: 'play',
+ /**
+ * !#en Emit when stop playing animation
+ * !#zh 停止播放时触发
+ * @property {String} STOP
+ * @static
+ */
+ STOP: 'stop',
+ /**
+ * !#en Emit when pause animation
+ * !#zh 暂停播放时触发
+ * @property {String} PAUSE
+ * @static
+ */
+ PAUSE: 'pause',
+ /**
+ * !#en Emit when resume animation
+ * !#zh 恢复播放时触发
+ * @property {String} RESUME
+ * @static
+ */
+ RESUME: 'resume',
+ /**
+ * !#en If animation repeat count is larger than 1, emit when animation play to the last frame
+ * !#zh 假如动画循环次数大于 1,当动画播放到最后一帧时触发
+ * @property {String} LASTFRAME
+ * @static
+ */
+ LASTFRAME: 'lastframe',
+ /**
+ * !#en Emit when finish playing animation
+ * !#zh 动画播放完成时触发
+ * @property {String} FINISHED
+ * @static
+ */
+ FINISHED: 'finished'
+})
+
/**
* !#en The animation component is used to play back animations.
*
@@ -73,6 +125,10 @@ var Animation = cc.Class({
executeInEditMode: true,
},
+ statics: {
+ EventType
+ },
+
ctor: function () {
cc.EventTarget.call(this);
diff --git a/cocos2d/core/components/CCMask.js b/cocos2d/core/components/CCMask.js
index 2402af7378..b17629dfff 100644
--- a/cocos2d/core/components/CCMask.js
+++ b/cocos2d/core/components/CCMask.js
@@ -32,8 +32,8 @@ const StencilMaterial = renderEngine.StencilMaterial;
const RenderComponent = require('./CCRenderComponent');
const RenderFlow = require('../renderer/render-flow');
+let _vec2_temp = cc.v2();
let _mat4_temp = math.mat4.create();
-let _rect_temp = cc.rect();
/**
* !#en the type for mask.
@@ -313,30 +313,25 @@ let Mask = cc.Class({
this.markForRender(true);
},
- _hitTest: function (point) {
+ _hitTest: function (cameraPt) {
let node = this.node;
let size = node.getContentSize(),
w = size.width,
- h = size.height;
- node.getWorldMatrix(_mat4_temp);
+ h = size.height,
+ testPt = _vec2_temp;
+
+ node._updateWorldMatrix();
+ math.mat4.invert(_mat4_temp, node._worldMatrix);
+ math.vec2.transformMat4(testPt, cameraPt, _mat4_temp);
+ testPt.x += node._anchorPoint.x * w;
+ testPt.y += node._anchorPoint.y * h;
if (this.type === MaskType.RECT || this.type === MaskType.IMAGE_STENCIL) {
- _rect_temp.x = -node.anchorX * w,
- _rect_temp.y = -node.anchorX * h;
- _rect_temp.width = w;
- _rect_temp.height = h;
- _rect_temp.transformMat4(_rect_temp, _mat4_temp);
-
- let left = point.x - _rect_temp.x,
- right = _rect_temp.x + _rect_temp.width - point.x,
- bottom = point.y - _rect_temp.y,
- top = _rect_temp.y + _rect_temp.height - point.y;
-
- return left >= 0 && right >= 0 && top >= 0 && bottom >= 0;
+ return testPt.x >= 0 && testPt.y >= 0 && testPt.x <= w && testPt.y <= h;
}
else if (this.type === MaskType.ELLIPSE) {
let rx = w / 2, ry = h / 2;
- let px = point.x - _mat4_temp.m12, py = point.y - _mat4_temp.m13;
+ let px = testPt.x - 0.5 * w, py = testPt.y - 0.5 * h;
return px * px / (rx * rx) + py * py / (ry * ry) < 1;
}
},
diff --git a/cocos2d/core/event-manager/CCEvent.js b/cocos2d/core/event-manager/CCEvent.js
index 72b67a75f0..feb282dafa 100644
--- a/cocos2d/core/event-manager/CCEvent.js
+++ b/cocos2d/core/event-manager/CCEvent.js
@@ -103,7 +103,7 @@ proto.setLocation = function (x, y) {
* @return {Vec2} location
*/
proto.getLocation = function () {
- return {x: this._x, y: this._y};
+ return cc.v2(this._x, this._y);
};
/**
@@ -113,7 +113,7 @@ proto.getLocation = function () {
* @return {Vec2}
*/
proto.getLocationInView = function() {
- return {x: this._x, y: cc.view._designResolutionSize.height - this._y};
+ return cc.v2(this._x, cc.view._designResolutionSize.height - this._y);
};
proto._setPrevCursor = function (x, y) {
@@ -128,7 +128,7 @@ proto._setPrevCursor = function (x, y) {
* @return {Vec2}
*/
proto.getPreviousLocation = function () {
- return {x: this._prevX, y: this._prevY};
+ return cc.v2(this._prevX, this._prevY);
};
/**
@@ -138,7 +138,7 @@ proto.getPreviousLocation = function () {
* @return {Vec2}
*/
proto.getDelta = function () {
- return {x: this._x - this._prevX, y: this._y - this._prevY};
+ return cc.v2(this._x - this._prevX, this._y - this._prevY);
};
/**
diff --git a/cocos2d/core/event/event-target.js b/cocos2d/core/event/event-target.js
index cc419f6f72..888594f87e 100644
--- a/cocos2d/core/event/event-target.js
+++ b/cocos2d/core/event/event-target.js
@@ -81,7 +81,11 @@ var proto = EventTarget.prototype;
* @param {String} type - A string representing the event type to listen for.
* @param {Function} callback - The callback that will be invoked when the event is dispatched.
* The callback is ignored if it is a duplicate (the callbacks are unique).
- * @param {Event} callback.event event
+ * @param {Event} callback.arg1 arg1
+ * @param {Event} callback.arg2 arg2
+ * @param {Event} callback.arg3 arg3
+ * @param {Event} callback.arg4 arg4
+ * @param {Event} callback.arg5 arg5
* @param {Object} [target] - The target (this object) to invoke the callback, can be null
* @return {Function} - Just returns the incoming callback so you can save the anonymous function easier.
* @typescript
@@ -165,7 +169,11 @@ proto.targetOff = proto.removeAll;
* @param {String} type - A string representing the event type to listen for.
* @param {Function} callback - The callback that will be invoked when the event is dispatched.
* The callback is ignored if it is a duplicate (the callbacks are unique).
- * @param {Event} callback.event event
+ * @param {Event} callback.arg1 arg1
+ * @param {Event} callback.arg2 arg2
+ * @param {Event} callback.arg3 arg3
+ * @param {Event} callback.arg4 arg4
+ * @param {Event} callback.arg5 arg5
* @param {Object} [target] - The target (this object) to invoke the callback, can be null
* @example
* eventTarget.once('fire', function (event) {
@@ -177,10 +185,10 @@ proto.once = function (type, callback, target) {
var hasOnceListener = this.hasEventListener(eventType_hasOnceListener, callback, target);
if (!hasOnceListener) {
var self = this;
- var onceWrapper = function (event) {
+ var onceWrapper = function (arg1, arg2, arg3, arg4, arg5) {
self.off(type, onceWrapper, target);
self.remove(eventType_hasOnceListener, callback, target);
- callback.call(this, event);
+ callback.call(this, arg1, arg2, arg3, arg4, arg5);
};
this.on(type, onceWrapper, target);
this.add(eventType_hasOnceListener, callback, target);
diff --git a/cocos2d/core/utils/polyfill-3d.js b/cocos2d/core/utils/polyfill-3d.js
index 7152dd6a9a..2b9a6ae5d1 100644
--- a/cocos2d/core/utils/polyfill-3d.js
+++ b/cocos2d/core/utils/polyfill-3d.js
@@ -249,6 +249,8 @@ cc._polyfill3D = module.exports = {
proto.setPosition = setPosition;
proto.getScale = getScale;
proto.setScale = setScale;
+ proto.getQuat = getQuat;
+ proto.setQuat = setQuat;
this.enabled = true;
}
},
diff --git a/cocos2d/core/value-types/vec2.js b/cocos2d/core/value-types/vec2.js
index 3abe4c2d67..c6ba141759 100644
--- a/cocos2d/core/value-types/vec2.js
+++ b/cocos2d/core/value-types/vec2.js
@@ -465,7 +465,6 @@ proto.normalizeSelf = function () {
return this;
if (magSqr === 0.0) {
- console.warn("Can't normalize zero vector");
return this;
}
diff --git a/extensions/spine/spine-assembler.js b/extensions/spine/spine-assembler.js
index 7f0901781c..062142251c 100644
--- a/extensions/spine/spine-assembler.js
+++ b/extensions/spine/spine-assembler.js
@@ -214,8 +214,8 @@ var spineAssembler = {
}
// Fill up indices
+ indices = data._indices;
if (attachment instanceof spine.RegionAttachment) {
- indices = data._indices;
indices[indiceOffset] = vertexOffset;
indices[indiceOffset + 1] = vertexOffset + 1;
indices[indiceOffset + 2] = vertexOffset + 2;