Skip to content

Commit

Permalink
Merge pull request #45 from jareguo/master
Browse files Browse the repository at this point in the history
emit events if node's all the editable properties changed
  • Loading branch information
jareguo committed Dec 14, 2015
2 parents 306f66a + 0a6724e commit 0992498
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 55 deletions.
24 changes: 23 additions & 1 deletion cocos2d/core/CCNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ var DontDestroy = Flags.DontDestroy;

/**
* Class of all entities in Fireball scenes.
*
* @class Node
* @extends _BaseNode
*/
var Node = cc.Class({
name: 'cc.Node',
extends: require('./utils/base-node'),
mixins: [cc.EventTarget],

properties: {
/**
Expand Down Expand Up @@ -586,4 +586,26 @@ var Node = cc.Class({

});

/**
* @event position-changed
*/
/**
* @event rotation-changed
*/
/**
* @event scale-changed
*/
/**
* @event size-changed
*/
/**
* @event anchor-changed
*/
/**
* @event color-changed
*/
/**
* @event opacity-changed
*/

cc.Node = module.exports = Node;
11 changes: 2 additions & 9 deletions cocos2d/core/platform/CCClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ function FireClass (options) {
cc.Component._registerEditorProps(cls, editor);
}
else {
cc.warn('Can only define "editor" attribute for sub class of Components.');
cc.warn('Can not use "editor" attribute, "%s" not inherits from Components.', name);
}
}
}
Expand Down Expand Up @@ -840,7 +840,7 @@ FireClass.attr = Attr.attr;

var tmpAttrs = [];
function parseAttributes (attrs, className, propName) {
var ERR_Type = (CC_EDITOR || CC_TEST) ? 'The %s of %s must be type %s' : '';
var ERR_Type = CC_DEV ? 'The %s of %s must be type %s' : '';

tmpAttrs.length = 0;
var result = tmpAttrs;
Expand Down Expand Up @@ -906,13 +906,6 @@ function parseAttributes (attrs, className, propName) {
break;
}
}
//else {
// if (attrs.default != null) {
// result.push({
// expectedTypeOf: typeof attrs.default,
// });
// }
//}

function parseSimpleAttr (attrName, expectType, attrCreater) {
var val = attrs[attrName];
Expand Down
Loading

0 comments on commit 0992498

Please sign in to comment.