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
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) {
/**
* @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;
}
}
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);
}
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) {