Unregister animations only once - on reset css

This commit is contained in:
vakrilov
2016-07-15 11:42:04 +03:00
parent b07dd305ae
commit 1b00fe9a18
3 changed files with 23 additions and 22 deletions

View File

@@ -10,14 +10,14 @@ import * as frameModule from "ui/frame";
import proxy = require("ui/core/proxy");
import keyframeAnimation = require("ui/animation/keyframe-animation");
var fs: typeof fileSystemModule;
let fs: typeof fileSystemModule;
function ensureFS() {
if (!fs) {
fs = require("file-system");
}
}
var frame: typeof frameModule;
let frame: typeof frameModule;
function ensureFrame() {
if (!frame) {
frame = require("ui/frame");
@@ -25,14 +25,14 @@ function ensureFrame() {
}
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
var AffectsLayout = global.android ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
const AffectsLayout = global.android ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
var backgroundSpanUnderStatusBarProperty = new Property("backgroundSpanUnderStatusBar", "Page", new proxy.PropertyMetadata(false, AffectsLayout));
const backgroundSpanUnderStatusBarProperty = new Property("backgroundSpanUnderStatusBar", "Page", new proxy.PropertyMetadata(false, AffectsLayout));
var actionBarHiddenProperty = new Property("actionBarHidden", "Page", new proxy.PropertyMetadata(undefined, AffectsLayout));
const actionBarHiddenProperty = new Property("actionBarHidden", "Page", new proxy.PropertyMetadata(undefined, AffectsLayout));
function onActionBarHiddenPropertyChanged(data: PropertyChangeData) {
var page = <Page>data.object;
const page = <Page>data.object;
if (page.isLoaded) {
page._updateActionBar(data.newValue);
}
@@ -167,8 +167,8 @@ export class Page extends ContentView implements dts.Page {
}
if (!this._cssFiles[cssFileName]) {
if (fs.File.exists(cssFileName)) {
var file = fs.File.fromPath(cssFileName);
var text = file.readTextSync();
const file = fs.File.fromPath(cssFileName);
const text = file.readTextSync();
if (text) {
this._addCssInternal(text, cssFileName);
this._cssFiles[cssFileName] = true;
@@ -224,11 +224,11 @@ export class Page extends ContentView implements dts.Page {
this._showNativeModalView(<any>frame.topmost().currentPage, undefined, undefined, true);
return this;
} else {
var context: any = arguments[1];
var closeCallback: Function = arguments[2];
var fullscreen: boolean = arguments[3];
const context: any = arguments[1];
const closeCallback: Function = arguments[2];
const fullscreen: boolean = arguments[3];
var page: Page;
let page: Page;
if (arguments[0] instanceof Page) {
page = <Page>arguments[0];
} else {
@@ -261,7 +261,7 @@ export class Page extends ContentView implements dts.Page {
protected _showNativeModalView(parent: Page, context: any, closeCallback: Function, fullscreen?: boolean) {
parent._modal = this;
var that = this;
const that = this;
this._modalContext = context;
this._closeModalCallback = function () {
if (that._closeModalCallback) {
@@ -285,7 +285,7 @@ export class Page extends ContentView implements dts.Page {
object: this,
context: this._modalContext,
closeCallback: this._closeModalCallback
}
};
this.notify(args);
}
@@ -319,11 +319,11 @@ export class Page extends ContentView implements dts.Page {
this._styleScope.ensureSelectors();
var scope = this._styleScope;
var checkSelectors = (view: view.View): boolean => {
const scope = this._styleScope;
const checkSelectors = (view: view.View): boolean => {
scope.applySelectors(view);
return true;
}
};
checkSelectors(this);
view.eachDescendant(this, checkSelectors);
@@ -332,10 +332,10 @@ export class Page extends ContentView implements dts.Page {
}
private _resetCssValues() {
var resetCssValuesFunc = (view: view.View): boolean => {
const resetCssValuesFunc = (view: view.View): boolean => {
view.style._resetCssValues();
return true;
}
};
resetCssValuesFunc(this);
view.eachDescendant(this, resetCssValuesFunc);

View File

@@ -66,7 +66,6 @@ export class CssSelector {
}
public apply(view: view.View, valueSourceModifier: number) {
view._unregisterAllAnimations();
let modifier = valueSourceModifier || this.valueSourceModifier;
this.eachSetter((property, value) => {
if (types.isString(property)) {

View File

@@ -890,7 +890,9 @@ export class Style extends DependencyObservable implements styling.Style {
}
public _resetCssValues() {
var that = this;
this._view._unregisterAllAnimations();
const that = this;
this._eachSetProperty(function (property: Property) {
that._resetValue(property, ValueSource.Css);
return true;
@@ -898,7 +900,7 @@ export class Style extends DependencyObservable implements styling.Style {
}
public _resetLocalValues() {
var that = this;
const that = this;
this._eachSetProperty(function (property: Property) {
that._resetValue(property);
return true;