- Fix feature issue on redo.

This commit is contained in:
Paulo Gustavo Veiga 2012-09-27 23:28:24 -03:00
parent 22d9f7a199
commit e5ab234d01
3 changed files with 28 additions and 23 deletions

View File

@ -1040,7 +1040,7 @@ mindplot.Topic = new Class({
// Create a connection line ...
var outgoingLine = new mindplot.ConnectionLine(this, targetTopic);
outgoingLine.setVisibility(this.isVisible());
outgoingLine.setVisibility(true); // @Todo: This must be false. Check remove of all nodes and redo.
this._outgoingLine = outgoingLine;
workspace.appendChild(outgoingLine);

View File

@ -17,58 +17,61 @@
*/
mindplot.model.FeatureModel = new Class({
initialize:function(type) {
$assert(type, 'type can not be null');
Static:{
_nextUUID:function () {
if (!$defined(mindplot.model.FeatureModel._uuid)) {
mindplot.model.FeatureModel._uuid = 0;
}
mindplot.model.FeatureModel._uuid = mindplot.model.FeatureModel._uuid + 1;
console.log(mindplot.model.FeatureModel._uuid);
return mindplot.model.FeatureModel._uuid;
}
},
initialize:function (type, id) {
$assert(type, 'type can not be null');
this._id = $defined(id) ? this._id : mindplot.model.FeatureModel._nextUUID();
this._id = mindplot.model.FeatureModel._nextUUID();
this._type = type;
this._attributes = {};
// Create type method ...
this['is' + type.camelCase() + 'Model'] = function() {
this['is' + type.camelCase() + 'Model'] = function () {
return true;
};
},
getAttributes : function() {
getAttributes:function () {
return Object.clone(this._attributes);
},
setAttributes : function(attributes) {
setAttributes:function (attributes) {
for (key in attributes) {
this["set" + key.capitalize()](attributes[key]);
}
},
setAttribute : function(key, value) {
setAttribute:function (key, value) {
$assert(key, 'key id can not be null');
this._attributes[key] = value;
},
getAttribute : function(key) {
getAttribute:function (key) {
$assert(key, 'key id can not be null');
return this._attributes[key];
},
getId : function() {
getId:function () {
return this._id;
},
setId : function(id) {
setId:function (id) {
this._id = id;
},
getType:function() {
getType:function () {
return this._type;
}
});
mindplot.model.FeatureModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
}
this._uuid = this._uuid + 1;
return this._uuid;
};
});

View File

@ -47,7 +47,9 @@ mindplot.model.NodeModel = new Class({
removeFeature:function (feature) {
$assert(feature, 'feature can not be null');
this._feature.erase(feature);
this._feature = this._feature.filter(function (f) {
return feature.getId() != f.getId();
});
},
findFeatureByType:function (type) {