Commit 22fcf44d authored by Masayuki Tanaka's avatar Masayuki Tanaka

Merge pull request #860 from denisvmedia/master

Calling resize on each and every window resize drammatically slows down the browser
parents ae26e98e 6e974710
......@@ -7,6 +7,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
padding_right: undefined,
padding_top: undefined,
padding_bottom: undefined,
resize_auto: true,
zoom_enabled: false,
zoom_extent: undefined,
zoom_privileged: false,
......
......@@ -324,12 +324,20 @@ c3_chart_internal_fn.initWithData = function (data) {
window.onresize = $$.generateResize();
}
if (window.onresize.add) {
var timeout;
window.onresize.add(function () {
config.onresize.call($$);
});
window.onresize.add(function () {
$$.api.flush();
});
if (config.resize_auto) {
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