This commit is contained in:
Hristo Hristov
2016-12-02 18:01:33 +02:00
parent 0f45a0df5e
commit a64847ca9d
61 changed files with 2212 additions and 3181 deletions

View File

@@ -1,12 +1,9 @@
import definition = require("ui/progress");
import {View} from "ui/core/view";
import {Property} from "ui/core/dependency-observable";
import proxy = require("ui/core/proxy");
import { Progress as ProgressDefinition } from "ui/progress";
import { View } from "ui/core/view";
import { Property } from "ui/core/properties";
export class Progress extends View implements definition.Progress {
public static valueProperty = new Property("value", "Progress", new proxy.PropertyMetadata(0));
public static maxValueProperty = new Property("maxValue", "Progress", new proxy.PropertyMetadata(100));
export class ProgressBase extends View implements ProgressDefinition {
constructor() {
super();
@@ -15,23 +12,37 @@ export class Progress extends View implements definition.Progress {
this.value = 0;
}
get maxValue(): number {
return this._getValue(Progress.maxValueProperty);
}
set maxValue(newMaxValue: number) {
this._setValue(Progress.maxValueProperty, newMaxValue);
public value: number;
public maxValue: number;
// get maxValue(): number {
// return this._getValue(Progress.maxValueProperty);
// }
// set maxValue(newMaxValue: number) {
// this._setValue(Progress.maxValueProperty, newMaxValue);
// Adjust value if needed.
if (this.value > newMaxValue) {
this.value = newMaxValue;
}
}
// // Adjust value if needed.
// if (this.value > newMaxValue) {
// this.value = newMaxValue;
// }
// }
get value(): number {
return this._getValue(Progress.valueProperty);
}
set value(value: number) {
value = Math.min(value, this.maxValue);
this._setValue(Progress.valueProperty, value);
}
}
// get value(): number {
// return this._getValue(Progress.valueProperty);
// }
// set value(value: number) {
// value = Math.min(value, this.maxValue);
// this._setValue(Progress.valueProperty, value);
// }
}
/**
* Represents the observable property backing the value property of each Progress instance.
*/
export const valueProperty = new Property<ProgressBase, number>({ name: "value", defaultValue: 0 });
valueProperty.register(ProgressBase);
/**
* Represents the observable property backing the maxValue property of each Progress instance.
*/
export const maxValueProperty = new Property<ProgressBase, number>({ name: "maxValue", defaultValue: 100 });
maxValueProperty.register(ProgressBase);