Commit a3f9e986 authored by Denis V's avatar Denis V

Calling resize on each and every window resize drammatically slows down the browser #857

parent c7dfed6f
......@@ -7,6 +7,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
padding_right: undefined,
padding_top: undefined,
padding_bottom: undefined,
auto_resize: true,
zoom_enabled: false,
zoom_extent: undefined,
zoom_privileged: false,
......
......@@ -288,12 +288,20 @@ c3_chart_internal_fn.initWithData = function (data) {
window.onresize = $$.generateResize();
}
if (window.onresize.add) {
var timeout;
window.onresize.add(function () {
config.onresize.call($$);
});
if (config.auto_resize) {
window.onresize.add(function () {
if (timeout !== undefined) {
clearTimeout(timeout);
}
timeout = setTimeout(function () {
$$.api.flush();
}, 100);
});
}
window.onresize.add(function () {
config.onresized.call($$);
});
......
Markdown is supported
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