Laya layout算法
/** *重置对象的
* @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); } } }X
轴(水平方向)布局。
其中,
displayWidth是width*scaleX