Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/core.animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {isObject} from '../helpers/helpers.core';

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

defaults.set('animation', {
// Plain properties can be overridden in each object
Expand Down
16 changes: 8 additions & 8 deletions src/core/core.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import defaults from './core.defaults';
import {mergeIf, resolveObjectKey, isArray, isFunction, valueOrDefault} from '../helpers/helpers.core';
import {mergeIf, resolveObjectKey, isArray, isFunction, valueOrDefault, isObject} from '../helpers/helpers.core';
import {_attachContext, _createResolver, _descriptors} from '../helpers/helpers.config';

export function getIndexAxis(type, options) {
Expand Down Expand Up @@ -301,13 +301,14 @@ export default class Config {

/**
* @param {object[]} scopes
* @param {function|object} context
* @param {object} [context]
* @param {string[]} [prefixes]
*/
createResolver(scopes, context, prefixes = ['']) {
const cached = getResolver(this._resolverCache, scopes, prefixes);
return context && cached.needContext
? _attachContext(cached.resolver, isFunction(context) ? context() : context)
: cached.resolver;
const {resolver} = getResolver(this._resolverCache, scopes, prefixes);
return isObject(context)
? _attachContext(resolver, isFunction(context) ? context() : context)
: resolver;
}
}

Expand All @@ -323,8 +324,7 @@ function getResolver(resolverCache, scopes, prefixes) {
const resolver = _createResolver(scopes, prefixes);
cached = {
resolver,
subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover')),
needContext: needContext(resolver, Object.getOwnPropertyNames(resolver))
subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover'))
};
cache.set(cacheKey, cached);
}
Expand Down
3 changes: 1 addition & 2 deletions src/core/core.datasetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,7 @@ export default class DatasetController {
const config = me.chart.config;
const scopeKeys = config.datasetAnimationScopeKeys(me._type);
const scopes = config.getOptionScopes(me.getDataset().animation, scopeKeys);
const context = () => me.getContext(index, active, mode);
options = config.createResolver(scopes, context);
options = config.createResolver(scopes, me.getContext(index, active, mode));
}
const animations = new Animations(chart, options && options[mode] || options);
if (options && options._cacheable) {
Expand Down