]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Transition optimizations 1900/head
authorMathias Küsel <mathiask@hotmail.de>
Fri, 15 Jan 2016 12:06:03 +0000 (13:06 +0100)
committerMathias Küsel <mathiask@hotmail.de>
Fri, 15 Jan 2016 12:06:03 +0000 (13:06 +0100)
src/core/core.element.js

index d9c0d35a623715987693e2be9fe142b535bdd1da..4b43df1c2bfe73f96837f2248f09c503f8fdec17 100644 (file)
                        if (!this._view) {
                                this._view = helpers.clone(this._model);
                        }
+
+                       // No animation -> No Transition
+                       if (ease === 1) {
+                               this._view = this._model;
+                               this._start = null;
+                               return this;
+                       }
+
                        if (!this._start) {
                                this.pivot();
                        }
                                }
 
                                // Init if doesn't exist
-                               else if (!this._view[key]) {
-                                       if (typeof value === 'number' && isNaN(this._view[key]) === false) {
+                               else if (!this._view.hasOwnProperty(key)) {
+                                       if (typeof value === 'number' && !isNaN(this._view[key])) {
                                                this._view[key] = value * ease;
                                        } else {
-                                               this._view[key] = value || null;
+                                               this._view[key] = value;
                                        }
                                }
 
                                // No unnecessary computations
-                               else if (this._model[key] === this._view[key]) {
+                               else if (value === this._view[key]) {
                                        // It's the same! Woohoo!
                                }
 
@@ -70,9 +78,6 @@
                                }
                        }, this);
 
-                       if (ease === 1) {
-                               delete this._start;
-                       }
                        return this;
                },
                tooltipPosition: function() {