Laya layout算法

        /**
         * 

重置对象的 X 轴(水平方向)布局。

* @private
*/ public function resetLayoutX():void { var owner:Sprite = this.owner as Sprite; if (!owner) return; var parent:Sprite = owner.parent as Sprite; if (parent) { if (!isNaN(centerX)) { owner.x = Math.round((parent.width - owner.displayWidth) * 0.5 + centerX + owner.pivotX * owner.scaleX); } else if (!isNaN(left)) { owner.x = Math.round(left + owner.pivotX * owner.scaleX); if (!isNaN(right)) { //TODO:如果用width,会死循环 owner.width = (parent._width - left - right) / (owner.scaleX || 0.01); } } else if (!isNaN(right)) { owner.x = Math.round(parent.width - owner.displayWidth - right + owner.pivotX * owner.scaleX); } } }

 其中,

displayWidth是width*scaleX

转载于:https://www.cnblogs.com/ixenos/p/11411628.html

你可能感兴趣的:(Laya layout算法)