Bugfix : when moving mouse outside SVG element, labels could stay visible.
This commit is contained in:
parent
67e6fc2329
commit
14621fbaab
12
timeline.js
12
timeline.js
@ -474,6 +474,18 @@ Timeline.prototype.draw = function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clear also the labels when moving outside the SVG element
|
||||||
|
this.holder.addEventListener('mouseout', function() {
|
||||||
|
// Reinitialize all states
|
||||||
|
[].forEach.call(obj.holder.querySelectorAll('.point'), function(el) {
|
||||||
|
el.setAttribute('r', '4');
|
||||||
|
});
|
||||||
|
|
||||||
|
[].forEach.call(obj.holder.querySelectorAll('.label'), function(el) {
|
||||||
|
el.setAttribute('display', 'none');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if(this.x_callback !== false && points[point].x + 2.5 < this.parent_holder.offsetWidth - this.marginRight) {
|
if(this.x_callback !== false && points[point].x + 2.5 < this.parent_holder.offsetWidth - this.marginRight) {
|
||||||
element = this.createElement('text', {'class': 'legend_x', 'fill': 'gray', 'transform': 'translate(0, ' + this.parent_holder.offsetHeight + ') scale(1, -1)'});
|
element = this.createElement('text', {'class': 'legend_x', 'fill': 'gray', 'transform': 'translate(0, ' + this.parent_holder.offsetHeight + ') scale(1, -1)'});
|
||||||
element.appendChild(document.createTextNode(this.x_callback(this.raw_points[point].x)));
|
element.appendChild(document.createTextNode(this.x_callback(this.raw_points[point].x)));
|
||||||
|
2
timeline.min.js
vendored
2
timeline.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user