mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-22 07:08:42 -06:00
fix center alignment with padding
This commit is contained in:
parent
b59447f644
commit
a4c06ac61d
|
@ -182,10 +182,10 @@ impl UiElement for Container {
|
||||||
match (self.align.0, self.direction) {
|
match (self.align.0, self.direction) {
|
||||||
(Alignment::Begin, _) => (),
|
(Alignment::Begin, _) => (),
|
||||||
(Alignment::Center, UiDirection::Horizontal) => {
|
(Alignment::Center, UiDirection::Horizontal) => {
|
||||||
position.x += (ctx.measure.size.x - ctx.measure.hints.inner_content_size.unwrap().x) / 2.;
|
position.x += (ctx.measure.size.x - ctx.measure.hints.inner_content_size.unwrap().x) / 2. - self.padding.left;
|
||||||
},
|
},
|
||||||
(Alignment::Center, UiDirection::Vertical) => {
|
(Alignment::Center, UiDirection::Vertical) => {
|
||||||
position.y += (ctx.measure.size.y - ctx.measure.hints.inner_content_size.unwrap().y) / 2.;
|
position.y += (ctx.measure.size.y - ctx.measure.hints.inner_content_size.unwrap().y) / 2. - self.padding.top;
|
||||||
},
|
},
|
||||||
(Alignment::End, UiDirection::Horizontal) => {
|
(Alignment::End, UiDirection::Horizontal) => {
|
||||||
position.x += ctx.measure.size.x - ctx.measure.hints.inner_content_size.unwrap().x - self.padding.right - self.padding.left;
|
position.x += ctx.measure.size.x - ctx.measure.hints.inner_content_size.unwrap().x - self.padding.right - self.padding.left;
|
||||||
|
|
Loading…
Reference in a new issue