aboutsummaryrefslogtreecommitdiff
path: root/teensy
diff options
context:
space:
mode:
Diffstat (limited to 'teensy')
-rw-r--r--teensy/teensy_ui.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/teensy/teensy_ui.c b/teensy/teensy_ui.c
index 5450502..b68b7ab 100644
--- a/teensy/teensy_ui.c
+++ b/teensy/teensy_ui.c
@@ -330,36 +330,42 @@ bool tyui_begin_window_ex(
mouse_pos.x -= md.x;
mouse_pos.y -= md.y;
- ty_Recti title_rect = win->rect;
- title_rect.h = title_bar_height();
+ bool hovering_resizer = false;
// Grabbing resizer?
- ty_Vec2i win_end = ty_recti_end(win->rect);
- ty_Recti resize_rect = ty_recti(
- win_end.x - 10, win_end.y - 10 + TEXT_HEIGHT,
- 20, 20
- );
+ {
+ ty_Vec2i win_end = ty_recti_end(win->rect);
+ ty_Recti resize_rect = ty_recti(
+ win_end.x - 10, win_end.y - 10 + TEXT_HEIGHT,
+ 20, 20
+ );
- bool hovering_resizer =
- ty_pointi_in_recti(mouse_pos, resize_rect) ||
- ty_pointi_in_recti(ty_mouse_pos(), resize_rect);
+ hovering_resizer =
+ ty_pointi_in_recti(mouse_pos, resize_rect) ||
+ ty_pointi_in_recti(ty_mouse_pos(), resize_rect);
- if (ty_button_down(TY_BTN_DB_LMB) && hovering_resizer) {
- win->rect.w += md.x;
- win->rect.h += md.y;
+ if (ty_button_down(TY_BTN_DB_LMB) && hovering_resizer) {
+ win->rect.w += md.x;
+ win->rect.h += md.y;
+ }
}
+ ty_Recti title_rect = win->rect;
+ title_rect.h = title_bar_height();
+
// Grabbing title bar?
- if (
- ty_button_down(TY_BTN_DB_LMB) &&
- (ty_pointi_in_recti(mouse_pos, title_rect) ||
- ty_pointi_in_recti(ty_mouse_pos(), title_rect))
- ) {
- win->rect.x += md.x;
- win->rect.y += md.y;
+ {
+ if (
+ ty_button_down(TY_BTN_DB_LMB) &&
+ (ty_pointi_in_recti(mouse_pos, title_rect) ||
+ ty_pointi_in_recti(ty_mouse_pos(), title_rect))
+ ) {
+ win->rect.x += md.x;
+ win->rect.y += md.y;
- title_rect = win->rect;
- title_rect.h = title_bar_height();
+ title_rect = win->rect;
+ title_rect.h = title_bar_height();
+ }
}
clip_cmd(TY_CLIP_NONE);