SmartPropertyPrim.updateLevelBoundingInfo can now return a boolean to notify of the success or failure of the update. In case of failure another attempt to compute it will be made at the next get on the object.
@@ -203,8 +203,9 @@
return ((x * x) / (w * w) + (y * y) / (h * h)) <= 1;
}
- protected updateLevelBoundingInfo() {
+ protected updateLevelBoundingInfo(): boolean {
BoundingInfo2D.CreateFromSizeToRef(this.actualSize, this._levelBoundingInfo);
+ return true;
/**
@@ -340,7 +340,7 @@
return true;
let size: Size;
// If the size is set by the user, the boundingInfo is computed from this value
@@ -353,6 +353,7 @@
BoundingInfo2D.CreateFromSizeToRef(size, this._levelBoundingInfo);
// Method called only on renderable groups to prepare the rendering
@@ -369,11 +369,12 @@
return res;
if (!this._boundingMin) {
this._computeLines2D();
BoundingInfo2D.CreateFromMinMaxToRef(this._boundingMin.x, this._boundingMax.x, this._boundingMin.y, this._boundingMax.y, this._levelBoundingInfo);
@@ -2565,6 +2565,9 @@
this._boundingInfo.clear();
} else {
this._boundingInfo.copyFrom(this.levelBoundingInfo);
+ if (this._isFlagSet(SmartPropertyPrim.flagLevelBoundingInfoDirty)) {
+ return this._boundingInfo;
+ }
let bi = this._boundingInfo;
@@ -288,8 +288,9 @@
@@ -1178,8 +1178,11 @@
*/
public get levelBoundingInfo(): BoundingInfo2D {
if (this._isFlagSet(SmartPropertyPrim.flagLevelBoundingInfoDirty)) {
- this.updateLevelBoundingInfo();
- this._clearFlags(SmartPropertyPrim.flagLevelBoundingInfoDirty);
+ if (this.updateLevelBoundingInfo()) {
+ this._clearFlags(SmartPropertyPrim.flagLevelBoundingInfoDirty);
+ } else {
+ this._levelBoundingInfo.clear();
return this._levelBoundingInfo;
@@ -1187,8 +1190,8 @@
* This method must be overridden by a given Primitive implementation to compute its boundingInfo
-
+ return false;
@@ -241,8 +241,9 @@
this._alignToPixel = value;
BoundingInfo2D.CreateFromSizeToRef(this.size, this._levelBoundingInfo);
@@ -296,7 +296,11 @@
protected updateLevelBoundingInfo() {
+ if (!this.owner || !this._text) {