|
@@ -16,7 +16,7 @@ var BABYLON;
|
|
this.forceRefreshPrimitive = false;
|
|
this.forceRefreshPrimitive = false;
|
|
}
|
|
}
|
|
return PrepareRender2DContext;
|
|
return PrepareRender2DContext;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.PrepareRender2DContext = PrepareRender2DContext;
|
|
BABYLON.PrepareRender2DContext = PrepareRender2DContext;
|
|
var Render2DContext = (function () {
|
|
var Render2DContext = (function () {
|
|
function Render2DContext(renderMode) {
|
|
function Render2DContext(renderMode) {
|
|
@@ -73,7 +73,7 @@ var BABYLON;
|
|
Render2DContext._renderModeAlphaTest = 2;
|
|
Render2DContext._renderModeAlphaTest = 2;
|
|
Render2DContext._renderModeTransparent = 3;
|
|
Render2DContext._renderModeTransparent = 3;
|
|
return Render2DContext;
|
|
return Render2DContext;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.Render2DContext = Render2DContext;
|
|
BABYLON.Render2DContext = Render2DContext;
|
|
/**
|
|
/**
|
|
* This class store information for the pointerEventObservable Observable.
|
|
* This class store information for the pointerEventObservable Observable.
|
|
@@ -233,7 +233,7 @@ var BABYLON;
|
|
PrimitivePointerInfo._pointerLostCapture = 0x0200;
|
|
PrimitivePointerInfo._pointerLostCapture = 0x0200;
|
|
PrimitivePointerInfo._mouseWheelPrecision = 3.0;
|
|
PrimitivePointerInfo._mouseWheelPrecision = 3.0;
|
|
return PrimitivePointerInfo;
|
|
return PrimitivePointerInfo;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.PrimitivePointerInfo = PrimitivePointerInfo;
|
|
BABYLON.PrimitivePointerInfo = PrimitivePointerInfo;
|
|
/**
|
|
/**
|
|
* Defines the horizontal and vertical alignment information for a Primitive.
|
|
* Defines the horizontal and vertical alignment information for a Primitive.
|
|
@@ -374,8 +374,8 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
PrimitiveAlignment.prototype.fromString = function (value) {
|
|
PrimitiveAlignment.prototype.fromString = function (value) {
|
|
var m = value.trim().split(",");
|
|
var m = value.trim().split(",");
|
|
- for (var _i = 0; _i < m.length; _i++) {
|
|
|
|
- var v = m[_i];
|
|
|
|
|
|
+ for (var _i = 0, m_1 = m; _i < m_1.length; _i++) {
|
|
|
|
+ var v = m_1[_i];
|
|
v = v.toLocaleLowerCase().trim();
|
|
v = v.toLocaleLowerCase().trim();
|
|
// Horizontal
|
|
// Horizontal
|
|
var i = v.indexOf("h:");
|
|
var i = v.indexOf("h:");
|
|
@@ -406,7 +406,7 @@ var BABYLON;
|
|
PrimitiveAlignment._AlignCenter = 3;
|
|
PrimitiveAlignment._AlignCenter = 3;
|
|
PrimitiveAlignment._AlignStretch = 4;
|
|
PrimitiveAlignment._AlignStretch = 4;
|
|
return PrimitiveAlignment;
|
|
return PrimitiveAlignment;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.PrimitiveAlignment = PrimitiveAlignment;
|
|
BABYLON.PrimitiveAlignment = PrimitiveAlignment;
|
|
/**
|
|
/**
|
|
* Stores information about a Primitive that was intersected
|
|
* Stores information about a Primitive that was intersected
|
|
@@ -417,7 +417,7 @@ var BABYLON;
|
|
this.intersectionLocation = intersectionLocation;
|
|
this.intersectionLocation = intersectionLocation;
|
|
}
|
|
}
|
|
return PrimitiveIntersectedInfo;
|
|
return PrimitiveIntersectedInfo;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.PrimitiveIntersectedInfo = PrimitiveIntersectedInfo;
|
|
BABYLON.PrimitiveIntersectedInfo = PrimitiveIntersectedInfo;
|
|
/**
|
|
/**
|
|
* Define a thickness toward every edges of a Primitive to allow margin and padding.
|
|
* Define a thickness toward every edges of a Primitive to allow margin and padding.
|
|
@@ -456,8 +456,8 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
var res = false;
|
|
var res = false;
|
|
- for (var _i = 0; _i < m.length; _i++) {
|
|
|
|
- var cm = m[_i];
|
|
|
|
|
|
+ for (var _i = 0, m_2 = m; _i < m_2.length; _i++) {
|
|
|
|
+ var cm = m_2[_i];
|
|
res = this._extractString(cm, false) || res;
|
|
res = this._extractString(cm, false) || res;
|
|
}
|
|
}
|
|
if (!res) {
|
|
if (!res) {
|
|
@@ -607,7 +607,7 @@ var BABYLON;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
// Check for pixel
|
|
// Check for pixel
|
|
- var n;
|
|
|
|
|
|
+ var n = void 0;
|
|
pI = v.indexOf("px");
|
|
pI = v.indexOf("px");
|
|
if (pI !== -1) {
|
|
if (pI !== -1) {
|
|
n = v.substr(0, pI).trim();
|
|
n = v.substr(0, pI).trim();
|
|
@@ -954,13 +954,14 @@ var BABYLON;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Compute the positioning/size of an area considering the thickness of this object and a given alignment
|
|
* Compute the positioning/size of an area considering the thickness of this object and a given alignment
|
|
- * @param sourceArea the source area
|
|
|
|
|
|
+ * @param sourceArea the source area where the content must be sized/positioned
|
|
* @param contentSize the content size to position/resize
|
|
* @param contentSize the content size to position/resize
|
|
* @param alignment the alignment setting
|
|
* @param alignment the alignment setting
|
|
* @param dstOffset the position of the content
|
|
* @param dstOffset the position of the content
|
|
* @param dstArea the new size of the content
|
|
* @param dstArea the new size of the content
|
|
*/
|
|
*/
|
|
- PrimitiveThickness.prototype.computeWithAlignment = function (sourceArea, contentSize, alignment, dstOffset, dstArea) {
|
|
|
|
|
|
+ PrimitiveThickness.prototype.computeWithAlignment = function (sourceArea, contentSize, alignment, dstOffset, dstArea, computeLayoutArea) {
|
|
|
|
+ if (computeLayoutArea === void 0) { computeLayoutArea = false; }
|
|
// Fetch some data
|
|
// Fetch some data
|
|
var topType = this._getType(0, true);
|
|
var topType = this._getType(0, true);
|
|
var leftType = this._getType(1, true);
|
|
var leftType = this._getType(1, true);
|
|
@@ -985,6 +986,9 @@ var BABYLON;
|
|
dstOffset.x = this.leftPixels;
|
|
dstOffset.x = this.leftPixels;
|
|
}
|
|
}
|
|
dstArea.width = width;
|
|
dstArea.width = width;
|
|
|
|
+ if (computeLayoutArea) {
|
|
|
|
+ dstArea.width += this.leftPixels;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case PrimitiveAlignment.AlignRight:
|
|
case PrimitiveAlignment.AlignRight:
|
|
@@ -997,6 +1001,9 @@ var BABYLON;
|
|
dstOffset.x = Math.round(sourceArea.width - (width + this.rightPixels));
|
|
dstOffset.x = Math.round(sourceArea.width - (width + this.rightPixels));
|
|
}
|
|
}
|
|
dstArea.width = width;
|
|
dstArea.width = width;
|
|
|
|
+ if (computeLayoutArea) {
|
|
|
|
+ dstArea.width += this.rightPixels;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case PrimitiveAlignment.AlignStretch:
|
|
case PrimitiveAlignment.AlignStretch:
|
|
@@ -1041,6 +1048,9 @@ var BABYLON;
|
|
dstOffset.y = Math.round(sourceArea.height - (height + this.topPixels));
|
|
dstOffset.y = Math.round(sourceArea.height - (height + this.topPixels));
|
|
}
|
|
}
|
|
dstArea.height = height;
|
|
dstArea.height = height;
|
|
|
|
+ if (computeLayoutArea) {
|
|
|
|
+ dstArea.height += this.topPixels;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case PrimitiveAlignment.AlignBottom:
|
|
case PrimitiveAlignment.AlignBottom:
|
|
@@ -1053,6 +1063,9 @@ var BABYLON;
|
|
dstOffset.y = this.bottomPixels;
|
|
dstOffset.y = this.bottomPixels;
|
|
}
|
|
}
|
|
dstArea.height = height;
|
|
dstArea.height = height;
|
|
|
|
+ if (computeLayoutArea) {
|
|
|
|
+ dstArea.height += this.bottomPixels;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case PrimitiveAlignment.AlignStretch:
|
|
case PrimitiveAlignment.AlignStretch:
|
|
@@ -1131,7 +1144,7 @@ var BABYLON;
|
|
PrimitiveThickness.Percentage = 0x4;
|
|
PrimitiveThickness.Percentage = 0x4;
|
|
PrimitiveThickness.Pixel = 0x8;
|
|
PrimitiveThickness.Pixel = 0x8;
|
|
return PrimitiveThickness;
|
|
return PrimitiveThickness;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.PrimitiveThickness = PrimitiveThickness;
|
|
BABYLON.PrimitiveThickness = PrimitiveThickness;
|
|
/**
|
|
/**
|
|
* Main class used for the Primitive Intersection API
|
|
* Main class used for the Primitive Intersection API
|
|
@@ -1168,7 +1181,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return IntersectInfo2D;
|
|
return IntersectInfo2D;
|
|
- })();
|
|
|
|
|
|
+ }());
|
|
BABYLON.IntersectInfo2D = IntersectInfo2D;
|
|
BABYLON.IntersectInfo2D = IntersectInfo2D;
|
|
var Prim2DBase = (function (_super) {
|
|
var Prim2DBase = (function (_super) {
|
|
__extends(Prim2DBase, _super);
|
|
__extends(Prim2DBase, _super);
|
|
@@ -1206,7 +1219,8 @@ var BABYLON;
|
|
this._actualSize = null;
|
|
this._actualSize = null;
|
|
this._boundingSize = BABYLON.Size.Zero();
|
|
this._boundingSize = BABYLON.Size.Zero();
|
|
this._layoutArea = BABYLON.Size.Zero();
|
|
this._layoutArea = BABYLON.Size.Zero();
|
|
- this._layoutAreaPos = BABYLON.Vector2.Zero();
|
|
|
|
|
|
+ this._layoutAreaPos = null;
|
|
|
|
+ this._layoutBoundingInfo = null;
|
|
this._marginOffset = BABYLON.Vector2.Zero();
|
|
this._marginOffset = BABYLON.Vector2.Zero();
|
|
this._paddingOffset = BABYLON.Vector2.Zero();
|
|
this._paddingOffset = BABYLON.Vector2.Zero();
|
|
this._parentPaddingOffset = BABYLON.Vector2.Zero();
|
|
this._parentPaddingOffset = BABYLON.Vector2.Zero();
|
|
@@ -1247,7 +1261,7 @@ var BABYLON;
|
|
if (settings.dontInheritParentScale) {
|
|
if (settings.dontInheritParentScale) {
|
|
this._setFlags(BABYLON.SmartPropertyPrim.flagDontInheritParentScale);
|
|
this._setFlags(BABYLON.SmartPropertyPrim.flagDontInheritParentScale);
|
|
}
|
|
}
|
|
- this._setFlags((isPickable ? BABYLON.SmartPropertyPrim.flagIsPickable : 0) | BABYLON.SmartPropertyPrim.flagBoundingInfoDirty | BABYLON.SmartPropertyPrim.flagActualOpacityDirty | (isContainer ? BABYLON.SmartPropertyPrim.flagIsContainer : 0) | BABYLON.SmartPropertyPrim.flagActualScaleDirty);
|
|
|
|
|
|
+ this._setFlags((isPickable ? BABYLON.SmartPropertyPrim.flagIsPickable : 0) | BABYLON.SmartPropertyPrim.flagBoundingInfoDirty | BABYLON.SmartPropertyPrim.flagActualOpacityDirty | (isContainer ? BABYLON.SmartPropertyPrim.flagIsContainer : 0) | BABYLON.SmartPropertyPrim.flagActualScaleDirty | BABYLON.SmartPropertyPrim.flagLayoutBoundingInfoDirty);
|
|
if (settings.opacity != null) {
|
|
if (settings.opacity != null) {
|
|
this._opacity = settings.opacity;
|
|
this._opacity = settings.opacity;
|
|
}
|
|
}
|
|
@@ -1998,6 +2012,9 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._positioningDirty();
|
|
this._positioningDirty();
|
|
|
|
+ if (this.parent) {
|
|
|
|
+ this.parent._setFlags(BABYLON.SmartPropertyPrim.flagLayoutBoundingInfoDirty);
|
|
|
|
+ }
|
|
this._layoutArea = val;
|
|
this._layoutArea = val;
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
@@ -2009,12 +2026,15 @@ var BABYLON;
|
|
* The setter should only be called by a Layout Engine class.
|
|
* The setter should only be called by a Layout Engine class.
|
|
*/
|
|
*/
|
|
get: function () {
|
|
get: function () {
|
|
- return this._layoutAreaPos;
|
|
|
|
|
|
+ return this._layoutAreaPos || Prim2DBase._nullPosition;
|
|
},
|
|
},
|
|
set: function (val) {
|
|
set: function (val) {
|
|
- if (this._layoutAreaPos.equals(val)) {
|
|
|
|
|
|
+ if (this._layoutAreaPos && this._layoutAreaPos.equals(val)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if (this.parent) {
|
|
|
|
+ this.parent._setFlags(BABYLON.SmartPropertyPrim.flagLayoutBoundingInfoDirty);
|
|
|
|
+ }
|
|
this._positioningDirty();
|
|
this._positioningDirty();
|
|
this._layoutAreaPos = val;
|
|
this._layoutAreaPos = val;
|
|
},
|
|
},
|
|
@@ -2139,7 +2159,8 @@ var BABYLON;
|
|
var tps = new BABYLON.BoundingInfo2D();
|
|
var tps = new BABYLON.BoundingInfo2D();
|
|
for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
|
|
for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
|
|
var curChild = _a[_i];
|
|
var curChild = _a[_i];
|
|
- curChild.boundingInfo.transformToRef(curChild.localTransform, tps);
|
|
|
|
|
|
+ var bb = curChild.boundingInfo;
|
|
|
|
+ bb.transformToRef(curChild.localTransform, tps);
|
|
bi.unionToRef(tps, bi);
|
|
bi.unionToRef(tps, bi);
|
|
}
|
|
}
|
|
this._boundingInfo.maxToRef(Prim2DBase._bMax);
|
|
this._boundingInfo.maxToRef(Prim2DBase._bMax);
|
|
@@ -2151,6 +2172,45 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(Prim2DBase.prototype, "layoutBoundingInfo", {
|
|
|
|
+ /**
|
|
|
|
+ * Get the boundingInfo of the primitive's content arranged by a layout Engine
|
|
|
|
+ * If a particular child is not arranged by layout, it's boundingInfo is used instead to produce something as accurate as possible
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ if (this._isFlagSet(BABYLON.SmartPropertyPrim.flagLayoutBoundingInfoDirty)) {
|
|
|
|
+ if (!this._layoutBoundingInfo) {
|
|
|
|
+ this._layoutBoundingInfo = new BABYLON.BoundingInfo2D();
|
|
|
|
+ }
|
|
|
|
+ if (this.isSizedByContent) {
|
|
|
|
+ this._layoutBoundingInfo.clear();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._layoutBoundingInfo.copyFrom(this.levelBoundingInfo);
|
|
|
|
+ }
|
|
|
|
+ var bi = this._layoutBoundingInfo;
|
|
|
|
+ var tps = new BABYLON.BoundingInfo2D();
|
|
|
|
+ for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
|
|
|
|
+ var curChild = _a[_i];
|
|
|
|
+ var bb = void 0;
|
|
|
|
+ if (curChild._layoutAreaPos) {
|
|
|
|
+ var s = curChild._layoutArea;
|
|
|
|
+ BABYLON.BoundingInfo2D.CreateFromMinMaxToRef(0, s.width, 0, s.height, Prim2DBase._tpsBB);
|
|
|
|
+ bb = Prim2DBase._tpsBB;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ bb = curChild.boundingInfo;
|
|
|
|
+ }
|
|
|
|
+ bb.transformToRef(curChild.localTransform, tps);
|
|
|
|
+ bi.unionToRef(tps, bi);
|
|
|
|
+ }
|
|
|
|
+ this._clearFlags(BABYLON.SmartPropertyPrim.flagLayoutBoundingInfoDirty);
|
|
|
|
+ }
|
|
|
|
+ return this._layoutBoundingInfo;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(Prim2DBase.prototype, "isSizeAuto", {
|
|
Object.defineProperty(Prim2DBase.prototype, "isSizeAuto", {
|
|
/**
|
|
/**
|
|
* Determine if the size is automatically computed or fixed because manually specified.
|
|
* Determine if the size is automatically computed or fixed because manually specified.
|
|
@@ -2471,8 +2531,8 @@ var BABYLON;
|
|
//}
|
|
//}
|
|
};
|
|
};
|
|
Prim2DBase.prototype.updateCachedStatesOf = function (list, recurse) {
|
|
Prim2DBase.prototype.updateCachedStatesOf = function (list, recurse) {
|
|
- for (var _i = 0; _i < list.length; _i++) {
|
|
|
|
- var cur = list[_i];
|
|
|
|
|
|
+ for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
|
|
|
|
+ var cur = list_1[_i];
|
|
cur.updateCachedStates(recurse);
|
|
cur.updateCachedStates(recurse);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -2517,9 +2577,9 @@ var BABYLON;
|
|
}
|
|
}
|
|
var rot = BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 0, 1), this._rotation);
|
|
var rot = BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 0, 1), this._rotation);
|
|
var local;
|
|
var local;
|
|
- var pos = this.position;
|
|
|
|
|
|
+ var pos = this._position ? this.position : this.layoutAreaPos;
|
|
if (this._origin.x === 0 && this._origin.y === 0) {
|
|
if (this._origin.x === 0 && this._origin.y === 0) {
|
|
- local = BABYLON.Matrix.Compose(new BABYLON.Vector3(this._scale.x, this._scale.y, 1), rot, new BABYLON.Vector3(pos.x, pos.y, 0));
|
|
|
|
|
|
+ local = BABYLON.Matrix.Compose(new BABYLON.Vector3(this._scale.x, this._scale.y, 1), rot, new BABYLON.Vector3(pos.x + this._marginOffset.x, pos.y + this._marginOffset.y, 0));
|
|
this._localTransform = local;
|
|
this._localTransform = local;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -2533,7 +2593,7 @@ var BABYLON;
|
|
BABYLON.Matrix.ScalingToRef(this._scale.x, this._scale.y, 1, Prim2DBase._t0);
|
|
BABYLON.Matrix.ScalingToRef(this._scale.x, this._scale.y, 1, Prim2DBase._t0);
|
|
Prim2DBase._t2.multiplyToRef(Prim2DBase._t0, Prim2DBase._t1);
|
|
Prim2DBase._t2.multiplyToRef(Prim2DBase._t0, Prim2DBase._t1);
|
|
// -Origin * rotation * scale * (Origin + Position)
|
|
// -Origin * rotation * scale * (Origin + Position)
|
|
- BABYLON.Matrix.TranslationToRef((as.width * this._origin.x) + pos.x, (as.height * this._origin.y) + pos.y, 0, Prim2DBase._t2);
|
|
|
|
|
|
+ BABYLON.Matrix.TranslationToRef((as.width * this._origin.x) + pos.x + this._marginOffset.x, (as.height * this._origin.y) + pos.y + this._marginOffset.y, 0, Prim2DBase._t2);
|
|
Prim2DBase._t1.multiplyToRef(Prim2DBase._t2, this._localTransform);
|
|
Prim2DBase._t1.multiplyToRef(Prim2DBase._t2, this._localTransform);
|
|
}
|
|
}
|
|
this.clearPropertiesDirty(tflags);
|
|
this.clearPropertiesDirty(tflags);
|
|
@@ -2570,21 +2630,21 @@ var BABYLON;
|
|
this.clearPropertiesDirty(Prim2DBase.sizeProperty.flagId);
|
|
this.clearPropertiesDirty(Prim2DBase.sizeProperty.flagId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // Check for layout update
|
|
|
|
var positioningDirty = this._isFlagSet(BABYLON.SmartPropertyPrim.flagPositioningDirty);
|
|
var positioningDirty = this._isFlagSet(BABYLON.SmartPropertyPrim.flagPositioningDirty);
|
|
|
|
+ var positioningComputed = positioningDirty && !this._isFlagSet(BABYLON.SmartPropertyPrim.flagPositioningDirty);
|
|
|
|
+ // Check for layout update
|
|
if (this._isFlagSet(BABYLON.SmartPropertyPrim.flagLayoutDirty)) {
|
|
if (this._isFlagSet(BABYLON.SmartPropertyPrim.flagLayoutDirty)) {
|
|
this.owner.addUpdateLayoutCounter(1);
|
|
this.owner.addUpdateLayoutCounter(1);
|
|
this._layoutEngine.updateLayout(this);
|
|
this._layoutEngine.updateLayout(this);
|
|
this._clearFlags(BABYLON.SmartPropertyPrim.flagLayoutDirty);
|
|
this._clearFlags(BABYLON.SmartPropertyPrim.flagLayoutDirty);
|
|
}
|
|
}
|
|
- var positioningComputed = positioningDirty && !this._isFlagSet(BABYLON.SmartPropertyPrim.flagPositioningDirty);
|
|
|
|
var autoContentChanged = false;
|
|
var autoContentChanged = false;
|
|
if (this.isSizeAuto) {
|
|
if (this.isSizeAuto) {
|
|
if (!this._lastAutoSizeArea) {
|
|
if (!this._lastAutoSizeArea) {
|
|
- autoContentChanged = this.size !== null;
|
|
|
|
|
|
+ autoContentChanged = this.actualSize !== null;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- autoContentChanged = (!this._lastAutoSizeArea.equals(this.size));
|
|
|
|
|
|
+ autoContentChanged = (!this._lastAutoSizeArea.equals(this.actualSize));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Check for positioning update
|
|
// Check for positioning update
|
|
@@ -2619,10 +2679,10 @@ var BABYLON;
|
|
// Check if we have to update the globalTransform
|
|
// Check if we have to update the globalTransform
|
|
if (!this._globalTransform || localDirty || parentDirty || parentPaddingChanged || this._areSomeFlagsSet(BABYLON.SmartPropertyPrim.flagGlobalTransformDirty)) {
|
|
if (!this._globalTransform || localDirty || parentDirty || parentPaddingChanged || this._areSomeFlagsSet(BABYLON.SmartPropertyPrim.flagGlobalTransformDirty)) {
|
|
var globalTransform = this._parent ? this._parent._globalTransform : null;
|
|
var globalTransform = this._parent ? this._parent._globalTransform : null;
|
|
- var localTransform;
|
|
|
|
|
|
+ var localTransform = void 0;
|
|
Prim2DBase._transMtx.copyFrom(this._localTransform);
|
|
Prim2DBase._transMtx.copyFrom(this._localTransform);
|
|
- Prim2DBase._transMtx.m[12] += this._layoutAreaPos.x + this._marginOffset.x + parentPaddingOffset.x;
|
|
|
|
- Prim2DBase._transMtx.m[13] += this._layoutAreaPos.y + this._marginOffset.y + parentPaddingOffset.y;
|
|
|
|
|
|
+ Prim2DBase._transMtx.m[12] += parentPaddingOffset.x;
|
|
|
|
+ Prim2DBase._transMtx.m[13] += parentPaddingOffset.y;
|
|
localTransform = Prim2DBase._transMtx;
|
|
localTransform = Prim2DBase._transMtx;
|
|
this._globalTransform = this._parent ? localTransform.multiply(globalTransform) : localTransform.clone();
|
|
this._globalTransform = this._parent ? localTransform.multiply(globalTransform) : localTransform.clone();
|
|
this._invGlobalTransform = BABYLON.Matrix.Invert(this._globalTransform);
|
|
this._invGlobalTransform = BABYLON.Matrix.Invert(this._globalTransform);
|
|
@@ -2659,7 +2719,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Apply margin
|
|
// Apply margin
|
|
if (this._hasMargin) {
|
|
if (this._hasMargin) {
|
|
- this.margin.computeWithAlignment(this.layoutArea, this.size, this.marginAlignment, this._marginOffset, Prim2DBase._size);
|
|
|
|
|
|
+ this.margin.computeWithAlignment(this.layoutArea, this.size || this.actualSize, this.marginAlignment, this._marginOffset, Prim2DBase._size);
|
|
this.actualSize = Prim2DBase._size.clone();
|
|
this.actualSize = Prim2DBase._size.clone();
|
|
}
|
|
}
|
|
var isSizeAuto = this.isSizeAuto;
|
|
var isSizeAuto = this.isSizeAuto;
|
|
@@ -2694,11 +2754,11 @@ var BABYLON;
|
|
this._contentArea.copyFrom(Prim2DBase._icArea);
|
|
this._contentArea.copyFrom(Prim2DBase._icArea);
|
|
}
|
|
}
|
|
if (!this._position) {
|
|
if (!this._position) {
|
|
- var aPos = new BABYLON.Vector2(this._layoutAreaPos.x + this._marginOffset.x, this._layoutAreaPos.y + this._marginOffset.y);
|
|
|
|
|
|
+ var aPos = new BABYLON.Vector2(this.layoutAreaPos.x + this._marginOffset.x, this.layoutAreaPos.y + this._marginOffset.y);
|
|
this.actualPosition = aPos;
|
|
this.actualPosition = aPos;
|
|
}
|
|
}
|
|
if (isSizeAuto) {
|
|
if (isSizeAuto) {
|
|
- this._lastAutoSizeArea = this.size;
|
|
|
|
|
|
+ this._lastAutoSizeArea = this.actualSize;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
Object.defineProperty(Prim2DBase.prototype, "contentArea", {
|
|
Object.defineProperty(Prim2DBase.prototype, "contentArea", {
|
|
@@ -2912,6 +2972,7 @@ var BABYLON;
|
|
Prim2DBase.boundinbBoxReentrency = false;
|
|
Prim2DBase.boundinbBoxReentrency = false;
|
|
Prim2DBase.nullSize = BABYLON.Size.Zero();
|
|
Prim2DBase.nullSize = BABYLON.Size.Zero();
|
|
Prim2DBase._bMax = BABYLON.Vector2.Zero();
|
|
Prim2DBase._bMax = BABYLON.Vector2.Zero();
|
|
|
|
+ Prim2DBase._tpsBB = new BABYLON.BoundingInfo2D();
|
|
Prim2DBase._isCanvasInit = false;
|
|
Prim2DBase._isCanvasInit = false;
|
|
Prim2DBase._t0 = new BABYLON.Matrix();
|
|
Prim2DBase._t0 = new BABYLON.Matrix();
|
|
Prim2DBase._t1 = new BABYLON.Matrix();
|
|
Prim2DBase._t1 = new BABYLON.Matrix();
|
|
@@ -2973,6 +3034,6 @@ var BABYLON;
|
|
BABYLON.className("Prim2DBase")
|
|
BABYLON.className("Prim2DBase")
|
|
], Prim2DBase);
|
|
], Prim2DBase);
|
|
return Prim2DBase;
|
|
return Prim2DBase;
|
|
- })(BABYLON.SmartPropertyPrim);
|
|
|
|
|
|
+ }(BABYLON.SmartPropertyPrim));
|
|
BABYLON.Prim2DBase = Prim2DBase;
|
|
BABYLON.Prim2DBase = Prim2DBase;
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|