]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Do not force resize if the size has not changed 1854/head
authorEvert Timberg <evert.timberg@gmail.com>
Wed, 6 Jan 2016 01:16:18 +0000 (20:16 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Wed, 6 Jan 2016 01:16:18 +0000 (20:16 -0500)
src/core/core.controller.js

index 17b875c5e55c3d1345a528ea92970db672008018..ea58c3ef782a16a941449aca8a1d32c33046730f 100644 (file)
@@ -63,6 +63,7 @@
                        this.updateLayout();
                        this.resetElements();
                        this.initToolTip();
+                       this.draw();
                        this.update();
 
                        // TODO
                },
 
                resize: function resize(silent) {
-                       this.stop();
                        var canvas = this.chart.canvas;
                        var newWidth = helpers.getMaximumWidth(this.chart.canvas);
                        var newHeight = (this.options.maintainAspectRatio && isNaN(this.chart.aspectRatio) === false && isFinite(this.chart.aspectRatio) && this.chart.aspectRatio !== 0) ? newWidth / this.chart.aspectRatio : helpers.getMaximumHeight(this.chart.canvas);
 
+                       var sizeChanged = this.chart.width !== newWidth || this.chart.height !== newHeight;
+
                        canvas.width = this.chart.width = newWidth;
                        canvas.height = this.chart.height = newHeight;
 
                        helpers.retinaScale(this.chart);
 
-                       if (!silent) {
+                       if (!silent && sizeChanged) {
+                               this.stop();
                                this.update(this.options.responsiveAnimationDuration);
                        }