Skip to content

Commit be6c98a

Browse files
committedJul 14, 2024·
Remove redundant checks
1 parent e6665a7 commit be6c98a

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed
 

‎lib/src/element/child_window.cpp

+12-16
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ namespace cycfi::elements
126126
return true;
127127

128128
bool r = tracker::cursor(ctx, p, status);
129-
auto inner = ctx.bounds.inset(resize_margin, resize_margin);
130-
if (ctx.enabled && is_enabled() && ctx.bounds.includes(p) && !inner.includes(p))
129+
if (ctx.enabled && is_enabled())
131130
{
132131
auto const& b = ctx.bounds;
133132
bool l_resize = false;
134133
bool r_resize = false;
135134
bool t_resize = false;
136135
bool b_resize = false;
136+
137137
if (p.x >= b.left && p.x < b.left + resize_margin)
138138
l_resize = true;
139139
else if (p.x > b.right - resize_margin && p.x <= b.right)
@@ -195,20 +195,16 @@ namespace cycfi::elements
195195
auto state = get_state();
196196
if (state)
197197
{
198-
auto inner = ctx.bounds.inset(resize_margin, resize_margin);
199-
if (ctx.bounds.includes(btn.pos) && !inner.includes(btn.pos))
200-
{
201-
auto const& b = ctx.bounds;
202-
if (btn.pos.x >= b.left && btn.pos.x < b.left + resize_margin)
203-
state->_handle = window_resizer_tracker_info::left;
204-
else if (btn.pos.x > b.right - resize_margin && btn.pos.x <= b.right)
205-
state->_handle = window_resizer_tracker_info::right;
206-
207-
if (btn.pos.y >= b.top && btn.pos.y < b.top + resize_margin)
208-
state->_handle |= window_resizer_tracker_info::top;
209-
else if (btn.pos.y > b.bottom - resize_margin && btn.pos.y <= b.bottom)
210-
state->_handle |= window_resizer_tracker_info::bottom;
211-
}
198+
auto const& b = ctx.bounds;
199+
if (btn.pos.x >= b.left && btn.pos.x < b.left + resize_margin)
200+
state->_handle = window_resizer_tracker_info::left;
201+
else if (btn.pos.x > b.right - resize_margin && btn.pos.x <= b.right)
202+
state->_handle = window_resizer_tracker_info::right;
203+
204+
if (btn.pos.y >= b.top && btn.pos.y < b.top + resize_margin)
205+
state->_handle |= window_resizer_tracker_info::top;
206+
else if (btn.pos.y > b.bottom - resize_margin && btn.pos.y <= b.bottom)
207+
state->_handle |= window_resizer_tracker_info::bottom;
212208
}
213209
return r;
214210
}

0 commit comments

Comments
 (0)
Please sign in to comment.