Skip to content

Commit a73a8c4

Browse files
authored
Fix couple of animation bugs (#8439)
1 parent 7e6a711 commit a73a8c4

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/core/core.animations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {isObject} from '../helpers/helpers.core';
55

66
const numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];
77
const colors = ['borderColor', 'backgroundColor'];
8-
const animationOptions = ['duration', 'easing', 'from', 'to', 'type', 'easing', 'loop', 'fn'];
8+
const animationOptions = ['delay', 'duration', 'easing', 'fn', 'from', 'loop', 'to', 'type'];
99

1010
defaults.set('animation', {
1111
// Plain properties can be overridden in each object

src/core/core.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import defaults from './core.defaults';
2-
import {mergeIf, resolveObjectKey, isArray, isFunction, valueOrDefault} from '../helpers/helpers.core';
2+
import {mergeIf, resolveObjectKey, isArray, isFunction, valueOrDefault, isObject} from '../helpers/helpers.core';
33
import {_attachContext, _createResolver, _descriptors} from '../helpers/helpers.config';
44

55
export function getIndexAxis(type, options) {
@@ -301,13 +301,14 @@ export default class Config {
301301

302302
/**
303303
* @param {object[]} scopes
304-
* @param {function|object} context
304+
* @param {object} [context]
305+
* @param {string[]} [prefixes]
305306
*/
306307
createResolver(scopes, context, prefixes = ['']) {
307-
const cached = getResolver(this._resolverCache, scopes, prefixes);
308-
return context && cached.needContext
309-
? _attachContext(cached.resolver, isFunction(context) ? context() : context)
310-
: cached.resolver;
308+
const {resolver} = getResolver(this._resolverCache, scopes, prefixes);
309+
return isObject(context)
310+
? _attachContext(resolver, isFunction(context) ? context() : context)
311+
: resolver;
311312
}
312313
}
313314

@@ -323,8 +324,7 @@ function getResolver(resolverCache, scopes, prefixes) {
323324
const resolver = _createResolver(scopes, prefixes);
324325
cached = {
325326
resolver,
326-
subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover')),
327-
needContext: needContext(resolver, Object.getOwnPropertyNames(resolver))
327+
subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover'))
328328
};
329329
cache.set(cacheKey, cached);
330330
}

src/core/core.datasetController.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,7 @@ export default class DatasetController {
777777
const config = me.chart.config;
778778
const scopeKeys = config.datasetAnimationScopeKeys(me._type);
779779
const scopes = config.getOptionScopes(me.getDataset().animation, scopeKeys);
780-
const context = () => me.getContext(index, active, mode);
781-
options = config.createResolver(scopes, context);
780+
options = config.createResolver(scopes, me.getContext(index, active, mode));
782781
}
783782
const animations = new Animations(chart, options && options[mode] || options);
784783
if (options && options._cacheable) {

0 commit comments

Comments
 (0)