mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 03:43:48 +01:00
- Try to fix feature remove issues.
This commit is contained in:
parent
e5ab234d01
commit
3bd2242080
@ -281,10 +281,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
|
||||
// Update model ...
|
||||
var feature = model.createFeature(type, attributes);
|
||||
if ($defined(featureId)) {
|
||||
feature.setId(featureId);
|
||||
}
|
||||
var feature = model.createFeature(type, attributes,featureId);
|
||||
model.addFeature(feature);
|
||||
|
||||
|
||||
|
@ -41,14 +41,14 @@ mindplot.TopicFeature = {
|
||||
});
|
||||
},
|
||||
|
||||
createModel:function (id, attributes) {
|
||||
$assert(id, 'type can not be null');
|
||||
createModel:function (type, attributes, id) {
|
||||
$assert(type, 'type can not be null');
|
||||
$assert(attributes, 'attributes can not be null');
|
||||
|
||||
var model = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
|
||||
return elem.id == id;
|
||||
return elem.id == type;
|
||||
})[0].model;
|
||||
return new model(attributes);
|
||||
return new model(attributes, id);
|
||||
},
|
||||
|
||||
createIcon:function (topic, model, readOnly) {
|
||||
|
@ -30,7 +30,6 @@ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({
|
||||
|
||||
execute:function (commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicId)[0];
|
||||
|
||||
var feature = topic.findFeatureById(this._featureId);
|
||||
topic.removeFeature(feature);
|
||||
this._oldFeature = feature;
|
||||
@ -38,7 +37,6 @@ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({
|
||||
|
||||
undoExecute:function (commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicId)[0];
|
||||
|
||||
var feature = this._oldFeature;
|
||||
topic.addFeature(feature.getType(), feature.getAttributes(), this._featureId);
|
||||
this._oldFeature = null;
|
||||
|
@ -31,7 +31,7 @@ mindplot.model.FeatureModel = new Class({
|
||||
|
||||
initialize:function (type, id) {
|
||||
$assert(type, 'type can not be null');
|
||||
this._id = $defined(id) ? this._id : mindplot.model.FeatureModel._nextUUID();
|
||||
this._id = $defined(id) ? id : mindplot.model.FeatureModel._nextUUID();
|
||||
|
||||
this._type = type;
|
||||
this._attributes = {};
|
||||
|
@ -17,17 +17,17 @@
|
||||
*/
|
||||
|
||||
mindplot.model.IconModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize:function(attributes) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE);
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes, id) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE, id);
|
||||
this.setIconType(attributes.id);
|
||||
},
|
||||
|
||||
getIconType : function() {
|
||||
getIconType:function () {
|
||||
return this.getAttribute('id');
|
||||
},
|
||||
|
||||
setIconType : function(iconType) {
|
||||
setIconType:function (iconType) {
|
||||
$assert(iconType, 'iconType id can not be null');
|
||||
this.setAttribute('id', iconType);
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.LinkModel = new Class({
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE);
|
||||
initialize:function (attributes,id) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE,id);
|
||||
this.setUrl(attributes.url);
|
||||
},
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.NoteModel = new Class({
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE);
|
||||
initialize:function (attributes, id) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE, id);
|
||||
var noteText = attributes.text ? attributes.text : " ";
|
||||
this.setText(noteText);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user