Skip to content

Commit

Permalink
Merge pull request #19 from luknw/master
Browse files Browse the repository at this point in the history
Fix off-by-one error in NK_INTERSECT
  • Loading branch information
dumblob committed Dec 10, 2019
2 parents c7727a7 + 2c2b59c commit bb7c251
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -5622,7 +5622,8 @@ struct nk_context {
#define NK_INBOX(px, py, x, y, w, h)\
(NK_BETWEEN(px,x,x+w) && NK_BETWEEN(py,y,y+h))
#define NK_INTERSECT(x0, y0, w0, h0, x1, y1, w1, h1) \
(!(((x1 > (x0 + w0)) || ((x1 + w1) < x0) || (y1 > (y0 + h0)) || (y1 + h1) < y0)))
((x1 < (x0 + w0)) && (x0 < (x1 + w1)) && \
(y1 < (y0 + h0)) && (y0 < (y1 + h1)))
#define NK_CONTAINS(x, y, w, h, bx, by, bw, bh)\
(NK_INBOX(x,y, bx, by, bw, bh) && NK_INBOX(x+w,y+h, bx, by, bw, bh))

Expand Down Expand Up @@ -25475,6 +25476,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
/// - [yy]: Minor version with non-breaking API and library changes
/// - [zz]: Bug fix version with no direct changes to API
///
/// - 2019/12/10 (4.01.5) - Fix off-by-one error in NK_INTERSECT
/// - 2019/10/09 (4.01.4) - Fix bug for autoscrolling in nk_do_edit
/// - 2019/09/20 (4.01.3) - Fixed a bug wherein combobox cannot be closed by clicking the header
/// when NK_BUTTON_TRIGGER_ON_RELEASE is defined.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nuklear",
"version": "4.01.4",
"repo": "vurtun/nuklear",
"version": "4.01.5",
"repo": "Immediate-Mode-UI/Nuklear",
"description": "A small ANSI C gui toolkit",
"keywords": ["gl", "ui", "toolkit"],
"src": ["nuklear.h"]
Expand Down
1 change: 1 addition & 0 deletions src/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/// - [yy]: Minor version with non-breaking API and library changes
/// - [zz]: Bug fix version with no direct changes to API
///
/// - 2019/12/10 (4.01.5) - Fix off-by-one error in NK_INTERSECT
/// - 2019/10/09 (4.01.4) - Fix bug for autoscrolling in nk_do_edit
/// - 2019/09/20 (4.01.3) - Fixed a bug wherein combobox cannot be closed by clicking the header
/// when NK_BUTTON_TRIGGER_ON_RELEASE is defined.
Expand Down
3 changes: 2 additions & 1 deletion src/nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -5403,7 +5403,8 @@ struct nk_context {
#define NK_INBOX(px, py, x, y, w, h)\
(NK_BETWEEN(px,x,x+w) && NK_BETWEEN(py,y,y+h))
#define NK_INTERSECT(x0, y0, w0, h0, x1, y1, w1, h1) \
(!(((x1 > (x0 + w0)) || ((x1 + w1) < x0) || (y1 > (y0 + h0)) || (y1 + h1) < y0)))
((x1 < (x0 + w0)) && (x0 < (x1 + w1)) && \
(y1 < (y0 + h0)) && (y0 < (y1 + h1)))
#define NK_CONTAINS(x, y, w, h, bx, by, bw, bh)\
(NK_INBOX(x,y, bx, by, bw, bh) && NK_INBOX(x+w,y+h, bx, by, bw, bh))

Expand Down

0 comments on commit bb7c251

Please sign in to comment.