]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix initial animations (#7511)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Tue, 16 Jun 2020 21:56:42 +0000 (00:56 +0300)
committerGitHub <noreply@github.com>
Tue, 16 Jun 2020 21:56:42 +0000 (17:56 -0400)
* Fix initial animations

* CC

src/core/core.controller.js

index 71ac4e123e525b7cd925ba95074605fa0f90fa4f..118403b6e1f5f428b26c284ac95b80be4535f4b4 100644 (file)
@@ -229,7 +229,7 @@ class Chart {
                this.$plugins = undefined;
                this.$proxies = {};
                this._hiddenIndices = {};
-               this.attached = true;
+               this.attached = false;
 
                // Add the chart instance to the global namespace
                Chart.instances[me.id] = me;
@@ -333,16 +333,13 @@ class Chart {
                retinaScale(me, newRatio);
 
                if (!silent) {
-                       // Notify any plugins about the resize
                        plugins.notify(me, 'resize', [newSize]);
 
-                       // Notify of resize
-                       if (options.onResize) {
-                               options.onResize(me, newSize);
-                       }
+                       callCallback(options.onResize, [newSize], me);
 
-                       // Only apply 'resize' mode if we are attached, else do a regular update.
-                       me.update(me.attached && 'resize');
+                       if (me.attached) {
+                               me.update('resize');
+                       }
                }
        }