10 attr_dontExpand( &this->cm, false ),
11 attr_keepAspect( &this->cm, false ),
12 attr_resizeScales( &this->cm, false ),
13 attr_innerAnchor( &this->cm,
float3( 0.5, 0.5, 0.5 ) )
22 auto row = view->
Table( DebugTable ).
Row(
this );
28 row.Column(
"insize", this->insize );
29 row.Column(
"inpos", this->inpos );
30 row.Column(
"inscale", this->inscale );
38 if( this->
child.
dirty() || this->expectedSize.dirty() )
46 if( this->
child.
dirty() || this->child.Get()->preferredSize.dirty() )
61 if( this->
child.
dirty() || this->child.Get()->preferredSize.dirty() || this->size.dirty() || this->modelTransform.dirty()
62 || this->attr_dontExpand.dirty() || this->attr_keepAspect.dirty() || this->attr_innerAnchor.dirty() || this->scissor.dirty() )
66 void Align::inner_layout(
float3 & out_size,
float3 & out_position,
float3 & out_scale )
const
76 if( prefsize.x &&
size.x > prefsize.x )
78 if( prefsize.y &&
size.y > prefsize.y )
80 if( prefsize.z &&
size.z > prefsize.z )
87 float scale = std::numeric_limits< float >::infinity();
89 scale = std::min( scale,
size.x / prefsize.x );
91 scale = std::min( scale,
size.y / prefsize.y );
93 scale = std::min( scale,
size.z / prefsize.z );
96 size.x = prefsize.x * scale;
98 size.y = prefsize.y * scale;
100 size.z = prefsize.z * scale;
110 if( prefsize.x != 0 )
111 scale.x =
size.x / prefsize.x;
112 if( prefsize.y != 0 )
113 scale.y =
size.y / prefsize.y;
114 if( prefsize.z != 0 )
115 scale.z =
size.z / prefsize.z;
121 out_position = position;
132 bool refresh =
false;
133 if( this->size.dirty() || this->attr_dontExpand.dirty() || this->attr_keepAspect.dirty()
134 || this->attr_innerAnchor.dirty() || this->attr_resizeScales.dirty() || this->child.Get()->preferredSize.dirty() )
140 this->inner_layout( this->insize, this->inpos, this->inscale );
144 this->size.clear_dirty();
152 if( refresh || this->
child.
dirty() || this->modelTransform.dirty() || this->scissor.dirty() )