mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
CssAnimationProperty will register the same way CssProperty in the symbol maps and will register on the style with css name too
This commit is contained in:
@@ -10,8 +10,6 @@ export const unsetValue: any = new Object();
|
|||||||
let symbolPropertyMap = {};
|
let symbolPropertyMap = {};
|
||||||
let cssSymbolPropertyMap = {};
|
let cssSymbolPropertyMap = {};
|
||||||
|
|
||||||
let cssSymbolResetMap = {};
|
|
||||||
|
|
||||||
let inheritableProperties = new Array<InheritedProperty<any, any>>();
|
let inheritableProperties = new Array<InheritedProperty<any, any>>();
|
||||||
let inheritableCssProperties = new Array<InheritedCssProperty<any, any>>();
|
let inheritableCssProperties = new Array<InheritedCssProperty<any, any>>();
|
||||||
|
|
||||||
@@ -559,9 +557,10 @@ export class CssAnimationProperty<T extends Style, U> {
|
|||||||
const { valueConverter, equalityComparer, valueChanged, defaultValue } = options;
|
const { valueConverter, equalityComparer, valueChanged, defaultValue } = options;
|
||||||
const propertyName = options.name;
|
const propertyName = options.name;
|
||||||
this.name = propertyName;
|
this.name = propertyName;
|
||||||
this.cssName = (options.cssName || propertyName);
|
|
||||||
|
|
||||||
const cssName = "css:" + (options.cssName || propertyName);
|
const cssName = "css:" + (options.cssName || propertyName);
|
||||||
|
this.cssName = cssName;
|
||||||
|
|
||||||
const keyframeName = "keyframe:" + propertyName;
|
const keyframeName = "keyframe:" + propertyName;
|
||||||
this.keyframe = keyframeName;
|
this.keyframe = keyframeName;
|
||||||
const defaultName = "default:" + propertyName;
|
const defaultName = "default:" + propertyName;
|
||||||
@@ -623,10 +622,8 @@ export class CssAnimationProperty<T extends Style, U> {
|
|||||||
const stylePropertyDescriptor = descriptor(styleValue, ValueSource.Local, true, true, true);
|
const stylePropertyDescriptor = descriptor(styleValue, ValueSource.Local, true, true, true);
|
||||||
const keyframePropertyDescriptor = descriptor(keyframeValue, ValueSource.Keyframe, false, false, false);
|
const keyframePropertyDescriptor = descriptor(keyframeValue, ValueSource.Keyframe, false, false, false);
|
||||||
|
|
||||||
cssSymbolResetMap[cssValue] = cssName;
|
|
||||||
cssSymbolResetMap[keyframeValue] = keyframeName;
|
|
||||||
|
|
||||||
symbolPropertyMap[computedValue] = this;
|
symbolPropertyMap[computedValue] = this;
|
||||||
|
cssSymbolPropertyMap[computedValue] = this;
|
||||||
|
|
||||||
this.register = (cls: { prototype: T }) => {
|
this.register = (cls: { prototype: T }) => {
|
||||||
cls.prototype[defaultValueKey] = options.defaultValue;
|
cls.prototype[defaultValueKey] = options.defaultValue;
|
||||||
@@ -640,6 +637,9 @@ export class CssAnimationProperty<T extends Style, U> {
|
|||||||
Object.defineProperty(cls.prototype, defaultName, defaultPropertyDescriptor);
|
Object.defineProperty(cls.prototype, defaultName, defaultPropertyDescriptor);
|
||||||
Object.defineProperty(cls.prototype, cssName, cssPropertyDescriptor);
|
Object.defineProperty(cls.prototype, cssName, cssPropertyDescriptor);
|
||||||
Object.defineProperty(cls.prototype, propertyName, stylePropertyDescriptor);
|
Object.defineProperty(cls.prototype, propertyName, stylePropertyDescriptor);
|
||||||
|
if (options.cssName && options.cssName != options.name) {
|
||||||
|
Object.defineProperty(cls.prototype, options.cssName, stylePropertyDescriptor);
|
||||||
|
}
|
||||||
Object.defineProperty(cls.prototype, keyframeName, keyframePropertyDescriptor);
|
Object.defineProperty(cls.prototype, keyframeName, keyframePropertyDescriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -979,8 +979,9 @@ export function resetCSSProperties(style: Style): void {
|
|||||||
let cssProperty;
|
let cssProperty;
|
||||||
if (cssProperty = cssSymbolPropertyMap[symbol]) {
|
if (cssProperty = cssSymbolPropertyMap[symbol]) {
|
||||||
style[cssProperty.cssName] = unsetValue;
|
style[cssProperty.cssName] = unsetValue;
|
||||||
} else if (cssProperty = cssSymbolResetMap[symbol]) {
|
if (cssProperty instanceof CssAnimationProperty) {
|
||||||
style[cssProperty] = unsetValue;
|
style[cssProperty.keyframe] = unsetValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user