Minor fix.

This commit is contained in:
Paulo Veiga 2011-10-04 23:59:21 -03:00
parent 9185883d30
commit b0e5923fec
3 changed files with 13 additions and 6 deletions

View File

@ -323,13 +323,21 @@ mindplot.widget.Menu = new Class({
var rels = designer.getModel().filterSelectedRelations(); var rels = designer.getModel().filterSelectedRelations();
this._toolbarElems.forEach(function(button) { this._toolbarElems.forEach(function(button) {
if (button.isTopicAction() && topics.length == 0) { var disable = false;
if (button.isTopicAction() && button.isRelAction()) {
disable = rels.length == 0 && topics.length == 0;
} else if (button.isTopicAction() && topics.length == 0) {
disable = true;
} else if (button.isRelAction() && rels.length == 0) {
disable = true;
}
if (disable) {
button.disable(); button.disable();
} }
if (button.isRelAction() && rels.length == 0) {
button.disable();
}
}) })
}.bind(this)); }.bind(this));

View File

@ -24,7 +24,6 @@ mindplot.widget.ToolbarItem = new Class({
this._buttonId = buttonId; this._buttonId = buttonId;
this._fn = fn; this._fn = fn;
this._options = options; this._options = options;
}, },
getButtonElem : function() { getButtonElem : function() {

View File

@ -30,7 +30,7 @@ mindplot.widget.ToolbarPaneItem = new Class({
} }
}.bind(this); }.bind(this);
this.parent(buttonId, fn, {topicAction:true,relAction:true}); this.parent(buttonId, fn, {topicAction:true,relAction:false});
this._model = model; this._model = model;
this._panelId = this._init().id; this._panelId = this._init().id;
}, },