Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -22034,14 +22034,16 @@ nk_layout_row_calculate_usable_space(const struct nk_style *style, enum nk_panel
float panel_space;

struct nk_vec2 spacing;
struct nk_vec2 padding;

NK_UNUSED(type);

spacing = style->window.spacing;
padding = nk_panel_get_padding(style, type);

/* calculate the usable panel space */
panel_spacing = (float)NK_MAX(columns - 1, 0) * spacing.x;
panel_space = total_space - panel_spacing;
panel_space = total_space - (2 * padding.x) - panel_spacing;
return panel_space;
}
NK_LIB void
Expand Down Expand Up @@ -22565,6 +22567,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
struct nk_panel *layout;
const struct nk_style *style;

struct nk_vec2 padding;
struct nk_vec2 spacing;

float item_offset = 0;
Expand All @@ -22584,6 +22587,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
NK_ASSERT(bounds);

spacing = style->window.spacing;
padding = nk_panel_get_padding(style, layout->type);
panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
layout->bounds.w, layout->row.columns);

Expand Down Expand Up @@ -22688,7 +22692,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
bounds->w = item_width;
bounds->h = layout->row.height - spacing.y;
bounds->y = layout->at_y - (float)*layout->offset_y;
bounds->x = layout->at_x + item_offset + item_spacing;
bounds->x = layout->at_x + item_offset + item_spacing + padding.x;
if (((bounds->x + bounds->w) > layout->max_x) && modify)
layout->max_x = bounds->x + bounds->w;
bounds->x -= (float)*layout->offset_x;
Expand Down
8 changes: 6 additions & 2 deletions src/nuklear_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ nk_layout_row_calculate_usable_space(const struct nk_style *style, enum nk_panel
float panel_space;

struct nk_vec2 spacing;
struct nk_vec2 padding;

NK_UNUSED(type);

spacing = style->window.spacing;
padding = nk_panel_get_padding(style, type);

/* calculate the usable panel space */
panel_spacing = (float)NK_MAX(columns - 1, 0) * spacing.x;
panel_space = total_space - panel_spacing;
panel_space = total_space - (2 * padding.x) - panel_spacing;
return panel_space;
}
NK_LIB void
Expand Down Expand Up @@ -579,6 +581,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
struct nk_panel *layout;
const struct nk_style *style;

struct nk_vec2 padding;
struct nk_vec2 spacing;

float item_offset = 0;
Expand All @@ -598,6 +601,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
NK_ASSERT(bounds);

spacing = style->window.spacing;
padding = nk_panel_get_padding(style, layout->type);
panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
layout->bounds.w, layout->row.columns);

Expand Down Expand Up @@ -702,7 +706,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
bounds->w = item_width;
bounds->h = layout->row.height - spacing.y;
bounds->y = layout->at_y - (float)*layout->offset_y;
bounds->x = layout->at_x + item_offset + item_spacing;
bounds->x = layout->at_x + item_offset + item_spacing + padding.x;
if (((bounds->x + bounds->w) > layout->max_x) && modify)
layout->max_x = bounds->x + bounds->w;
bounds->x -= (float)*layout->offset_x;
Expand Down