Skip to content

Commit

Permalink
fix(widget): Widget_GetOffset() result does not include padding spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Feb 21, 2018
1 parent 196f47c commit 0a893f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/widget_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,16 @@ void Widget_GetOffset( LCUI_Widget w, LCUI_Widget parent,
float *offset_x, float *offset_y )
{
float x = 0, y = 0;
while( w && w != parent ) {
while( w != parent ) {
x += w->box.border.x;
y += w->box.border.y;
w = w->parent;
if( w ) {
x += w->box.padding.x - w->box.border.x;
y += w->box.padding.y - w->box.border.y;
} else {
break;
}
}
*offset_x = x;
*offset_y = y;
Expand Down

0 comments on commit 0a893f4

Please sign in to comment.