Commit 55305946 authored by Remon Huijts's avatar Remon Huijts
Browse files

Improve code readability by inlining simplified code from two single shot functions

parent 47fbf40d
......@@ -123359,43 +123359,25 @@ ArrangePanel.prototype.old_init = ArrangePanel.prototype.init;
*/
ArrangePanel.prototype.init = function() {
this.old_init();
if (this.editorUi.editor.graph.getSelectionCount() == 1) {
this.addInteractionPanel();
} else {
this.addNoInteractionPanel();
}
};
/**
* Add a panel that explains why no interaction can be added.
*/
ArrangePanel.prototype.addNoInteractionPanel = function() {
var div = this.createPanel();
var title = this.createTitle(mxResources.get('no-interaction'));
div.appendChild(title);
var p = document.createElement('p');
mxUtils.write(p, mxResources.get('why-no-interaction'));
p.style.width = title.style.width;
p.style.whiteSpace = 'normal';
p.style.textAlign = title.style.textAlign;
div.appendChild(p);
this.container.appendChild(div);
};
/**
* Add a panel that defines an interaction.
*/
ArrangePanel.prototype.addInteractionPanel = function() {
var div = this.createPanel();
 
var title = this.createTitle('Interaction');
div.appendChild(title);
var eventRules = new EventRules(this);
div = eventRules.render(div);
if (this.editorUi.editor.graph.getSelectionCount() !== 1) {
// Explain why no interaction can be added:
var title = this.createTitle(mxResources.get('no-interaction'));
div.appendChild(title);
var p = document.createElement('p');
mxUtils.write(p, mxResources.get('why-no-interaction'));
p.style.width = title.style.width;
p.style.whiteSpace = 'normal';
p.style.textAlign = title.style.textAlign;
div.appendChild(p);
} else {
// Add the UI to manage interactions for a cell:
div.appendChild(this.createTitle('Interactions'));
var eventRules = new EventRules(this);
div = eventRules.render(div);
}
 
this.container.appendChild(div);
};
......@@ -37,43 +37,25 @@ ArrangePanel.prototype.old_init = ArrangePanel.prototype.init;
*/
ArrangePanel.prototype.init = function() {
this.old_init();
if (this.editorUi.editor.graph.getSelectionCount() == 1) {
this.addInteractionPanel();
} else {
this.addNoInteractionPanel();
}
};
/**
* Add a panel that explains why no interaction can be added.
*/
ArrangePanel.prototype.addNoInteractionPanel = function() {
var div = this.createPanel();
var title = this.createTitle(mxResources.get('no-interaction'));
div.appendChild(title);
var p = document.createElement('p');
mxUtils.write(p, mxResources.get('why-no-interaction'));
p.style.width = title.style.width;
p.style.whiteSpace = 'normal';
p.style.textAlign = title.style.textAlign;
div.appendChild(p);
this.container.appendChild(div);
};
/**
* Add a panel that defines an interaction.
*/
ArrangePanel.prototype.addInteractionPanel = function() {
var div = this.createPanel();
var title = this.createTitle('Interaction');
div.appendChild(title);
var eventRules = new EventRules(this);
div = eventRules.render(div);
if (this.editorUi.editor.graph.getSelectionCount() !== 1) {
// Explain why no interaction can be added:
var title = this.createTitle(mxResources.get('no-interaction'));
div.appendChild(title);
var p = document.createElement('p');
mxUtils.write(p, mxResources.get('why-no-interaction'));
p.style.width = title.style.width;
p.style.whiteSpace = 'normal';
p.style.textAlign = title.style.textAlign;
div.appendChild(p);
} else {
// Add the UI to manage interactions for a cell:
div.appendChild(this.createTitle('Interactions'));
var eventRules = new EventRules(this);
div = eventRules.render(div);
}
this.container.appendChild(div);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment