Fixed panel scaling to behave like windows native

This commit is contained in:
vurtun 2017-05-10 12:34:59 +02:00
parent 70d9de10c9
commit d9a57d42cd
2 changed files with 11 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# Changelog
[date][x.yy.zz]-[description]
- [date]: current date on which the change has been pushed
- [date]: date on which the change has been pushed
- [x.yy.zz]: Numerical version string representation. Each version number on the right
resets back to zero if version on the left is incremented.
- [x]: Major version with API and library breaking (extremly rare, maybe never)
@ -11,6 +11,7 @@
Changes:
--------
- 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries
- 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space
- 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size
- 2017/05/06 (1.38.0) - Added platform double-click support

View File

@ -17946,15 +17946,19 @@ nk_panel_end(struct nk_context *ctx)
window->bounds.x += in->mouse.delta.x;
}
/* dragging in x-direction */
if (window_size.x < window->bounds.w + delta_x) {
window->bounds.w = window->bounds.w + delta_x;
scaler.x += in->mouse.delta.x;
if (window->bounds.w + delta_x >= window_size.x) {
if ((delta_x < 0) || (delta_x > 0 && in->mouse.pos.x >= scaler.x)) {
window->bounds.w = window->bounds.w + delta_x;
scaler.x += in->mouse.delta.x;
}
}
/* dragging in y-direction (only possible if static window) */
if (!(layout->flags & NK_WINDOW_DYNAMIC)) {
if (window_size.y < window->bounds.h + in->mouse.delta.y) {
window->bounds.h = window->bounds.h + in->mouse.delta.y;
scaler.y += in->mouse.delta.y;
if ((in->mouse.delta.y < 0) || (in->mouse.delta.y > 0 && in->mouse.pos.y >= scaler.y)) {
window->bounds.h = window->bounds.h + in->mouse.delta.y;
scaler.y += in->mouse.delta.y;
}
}
}
ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_RESIZE_TOP_RIGHT_DOWN_LEFT];