Skip to content

Commit

Permalink
Fixed missing line controls after dragging line parts
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsMichelsen committed May 27, 2015
1 parent 3df9092 commit 5fdfc25
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions share/frontend/nagvis-js/js/ElementLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,20 @@ var ElementLine = Element.extend({
this.calcLineParts();
this.renderLine();
this.renderActionContainer();
this.renderLinkArea();
this.renderLabels();
},

place: function() {
// Totally redraw the line when moving the line anchors arround
// Totally redraw the line when moving the line anchors arround. But keep the trigger
// object because it saves the attached event handlers
var trigger_obj = this.obj.trigger_obj;
trigger_obj.parentNode.removeChild(trigger_obj);
while (trigger_obj.firstChild)
trigger_obj.removeChild(trigger_obj.firstChild);

this.erase();
this.obj.trigger_obj = trigger_obj;
this.render();
this.draw();
},
Expand All @@ -94,21 +102,26 @@ var ElementLine = Element.extend({
//

renderActionContainer: function() {
// This is only the container for the hover/label elements
// The real area or labels are added later
var oLink = document.createElement('a');
// This is only the container for the hover/label elements. The real area or labels
// are added later. But this container gets all event handlers assigned. Because
// the line is using erase(), render(), draw() within place() which is called while
// the user moves the object, this dom node must not be re-created, because this
// would remove all event handlers
if (!this.obj.trigger_obj) {
var oLink = document.createElement('a');
oLink.setAttribute('id', this.obj.conf.object_id+'-linelink');
oLink.className = 'linelink';
this.obj.trigger_obj = oLink;
} else {
var oLink = this.obj.trigger_obj;
}
this.dom_obj.appendChild(oLink);
this.obj.trigger_obj = oLink;
oLink.setAttribute('id', this.obj.conf.object_id+'-linelink');
oLink.className = 'linelink';
if (this.obj.conf.url) {
oLink.href = this.obj.conf.url;
oLink.target = this.obj.conf.url_target;
} else {
oLink.href = 'javascript:void(0)';
}

this.renderLinkArea();
},

toggleActionContainer: function() {
Expand Down

0 comments on commit 5fdfc25

Please sign in to comment.