mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 20:59:08 +02:00
Transition optimizations
This commit is contained in:
parent
fa7baa1627
commit
c42cb148da
@ -26,6 +26,14 @@
|
|||||||
if (!this._view) {
|
if (!this._view) {
|
||||||
this._view = helpers.clone(this._model);
|
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) {
|
if (!this._start) {
|
||||||
this.pivot();
|
this.pivot();
|
||||||
}
|
}
|
||||||
@ -37,16 +45,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init if doesn't exist
|
// Init if doesn't exist
|
||||||
else if (!this._view[key]) {
|
else if (!this._view.hasOwnProperty(key)) {
|
||||||
if (typeof value === 'number' && isNaN(this._view[key]) === false) {
|
if (typeof value === 'number' && !isNaN(this._view[key])) {
|
||||||
this._view[key] = value * ease;
|
this._view[key] = value * ease;
|
||||||
} else {
|
} else {
|
||||||
this._view[key] = value || null;
|
this._view[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No unnecessary computations
|
// No unnecessary computations
|
||||||
else if (this._model[key] === this._view[key]) {
|
else if (value === this._view[key]) {
|
||||||
// It's the same! Woohoo!
|
// It's the same! Woohoo!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,9 +78,6 @@
|
|||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (ease === 1) {
|
|
||||||
delete this._start;
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
tooltipPosition: function() {
|
tooltipPosition: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user