Resize working with latest refactor. TODO : Update doc.
This commit is contained in:
parent
a78a635057
commit
46ea55bd95
35
timeline.js
35
timeline.js
@ -47,6 +47,24 @@ function Timeline(arg) {
|
||||
this.raw_points = [];
|
||||
this.x_callback = false;
|
||||
|
||||
var old = window.onresize || function () {};
|
||||
var obj = this;
|
||||
window.onresize = function() {
|
||||
old();
|
||||
|
||||
// Redraw the Timeline to fit the new size
|
||||
if(obj.g !== false) {
|
||||
obj.g.setAttribute('transform', 'translate(0, ' + obj.parent_holder.offsetHeight + ') scale(1, -1)');
|
||||
if(obj.x_axis === true) {
|
||||
obj.axis.setAttribute('x2', obj.parent_holder.offsetWidth - 13 - obj.marginRight);
|
||||
}
|
||||
[].forEach.call(obj.holder.querySelectorAll('.label, .over, .point, .line, .graph, .legend_x'), function(el) {
|
||||
el.parentNode.removeChild(el);
|
||||
});
|
||||
obj.draw();
|
||||
}
|
||||
};
|
||||
|
||||
if(!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1")) {
|
||||
alert("ERROR : Your browser does not support embedded SVG.");
|
||||
}
|
||||
@ -555,20 +573,3 @@ Timeline.prototype.draw = function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// TODO
|
||||
var old = window.onresize || function () {};
|
||||
window.onresize = function() {
|
||||
old();
|
||||
// Redraw the Timeline to fit the new size
|
||||
if(Timeline.g !== false) {
|
||||
Timeline.g.setAttribute('transform', 'translate(0, ' + Timeline.parent_holder.offsetHeight + ') scale(1, -1)');
|
||||
if(Timeline.x_axis === true) {
|
||||
Timeline.axis.setAttribute('x2', Timeline.parent_holder.offsetWidth - 13 - Timeline.marginRight);
|
||||
}
|
||||
[].forEach.call(Timeline.holder.querySelectorAll('.label, .over, .point, .line, .graph, .legend_x'), function(el) {
|
||||
el.parentNode.removeChild(el);
|
||||
});
|
||||
Timeline.draw();
|
||||
}
|
||||
};
|
||||
|
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