Fix CssAnimationProperty default value (#4510)

This commit is contained in:
Hristo Hristov
2017-07-06 09:25:17 +03:00
committed by GitHub
parent 9a34fb9091
commit 974ef9d932
4 changed files with 35 additions and 3 deletions

View File

@@ -113,7 +113,17 @@ export class CssAnimationProperty<T extends Style, U> {
public register(cls: { prototype: T }): void;
public isSet(instance: T): boolean;
/**
* @private
*/
public _initDefaultNativeValue(target: T): void;
/**
* @private
*/
public _valueConverter?: (value: string) => any;
/**
* @private
*/
public static _getByCssName(name: string): CssAnimationProperty<any, any>;
}

View File

@@ -694,7 +694,7 @@ export class CssAnimationProperty<T extends Style, U> {
this.defaultValue = defaultValue;
const cssValue = Symbol(cssName);
const styleValue = Symbol(propertyName);
const styleValue = Symbol(`local:${propertyName}`);
const keyframeValue = Symbol(keyframeName);
const computedValue = Symbol("computed-value:" + propertyName);
this.key = computedValue;
@@ -792,6 +792,16 @@ export class CssAnimationProperty<T extends Style, U> {
}
}
public _initDefaultNativeValue(target: T): void {
const defaultValueKey = this.defaultValueKey;
if (!(defaultValueKey in target)) {
const view = target.view;
const getDefault = this.getDefault;
target[defaultValueKey] = view[getDefault] ? view[getDefault]() : this.defaultValue;
}
}
public static _getByCssName(name: string): CssAnimationProperty<any, any> {
return this.properties[name];
}

View File

@@ -738,7 +738,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
public _getValue(): never {
throw new Error("The View._setValue is obsolete. There is a new property system.");
throw new Error("The View._getValue is obsolete. There is a new property system.");
}
public _setValue(): never {