|
@@ -31,12 +31,28 @@ module BABYLON.GUI {
|
|
|
|
|
|
public getValue(host: AdvancedDynamicTexture): number {
|
|
public getValue(host: AdvancedDynamicTexture): number {
|
|
if (host && !this.ignoreAdaptiveScaling && this.unit !== ValueAndUnit.UNITMODE_PERCENTAGE) {
|
|
if (host && !this.ignoreAdaptiveScaling && this.unit !== ValueAndUnit.UNITMODE_PERCENTAGE) {
|
|
- var width: number = host.idealWidth ? (this._value * host.getSize().width) / host.idealWidth : 0;
|
|
|
|
- var height: number = host.idealHeight ? (this._value * host.getSize().height) / host.idealHeight : 0;
|
|
|
|
|
|
+ var width: number = 0;
|
|
|
|
+ var height: number = 0;
|
|
|
|
|
|
- if (host.useSmallestIdeal && host.idealWidth && host.idealHeight) return window.innerWidth < window.innerHeight ? width : height;
|
|
|
|
- if (host.idealWidth) return width; // horizontal
|
|
|
|
- if (host.idealHeight) return height; // vertical
|
|
|
|
|
|
+ if (host.idealWidth) {
|
|
|
|
+ width = (this._value * host.getSize().width) / host.idealWidth;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (host.idealHeight) {
|
|
|
|
+ height = (this._value * host.getSize().height) / host.idealHeight;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (host.useSmallestIdeal && host.idealWidth && host.idealHeight) {
|
|
|
|
+ return window.innerWidth < window.innerHeight ? width : height;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (host.idealWidth) { // horizontal
|
|
|
|
+ return width;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (host.idealHeight) { // vertical
|
|
|
|
+ return height;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return this._value;
|
|
return this._value;
|
|
}
|
|
}
|