vxfw(SplitView): reset state on mouse_leave
This commit is contained in:
parent
b9fb06d902
commit
8128bca021
1 changed files with 9 additions and 1 deletions
|
@ -35,7 +35,14 @@ pub fn widget(self: *const SplitView) vxfw.Widget {
|
||||||
|
|
||||||
fn typeErasedEventHandler(ptr: *anyopaque, ctx: *vxfw.EventContext, event: vxfw.Event) anyerror!void {
|
fn typeErasedEventHandler(ptr: *anyopaque, ctx: *vxfw.EventContext, event: vxfw.Event) anyerror!void {
|
||||||
const self: *SplitView = @ptrCast(@alignCast(ptr));
|
const self: *SplitView = @ptrCast(@alignCast(ptr));
|
||||||
if (event != .mouse) return;
|
switch (event) {
|
||||||
|
.mouse_leave => {
|
||||||
|
self.pressed = false;
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
.mouse => {},
|
||||||
|
else => return,
|
||||||
|
}
|
||||||
const mouse = event.mouse;
|
const mouse = event.mouse;
|
||||||
|
|
||||||
const separator_col: u16 = switch (self.constrain) {
|
const separator_col: u16 = switch (self.constrain) {
|
||||||
|
@ -71,6 +78,7 @@ fn typeErasedEventHandler(ptr: *anyopaque, ctx: *vxfw.EventContext, event: vxfw.
|
||||||
if (self.max_width) |max| {
|
if (self.max_width) |max| {
|
||||||
self.width = @min(self.width, max);
|
self.width = @min(self.width, max);
|
||||||
}
|
}
|
||||||
|
ctx.consume_event = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue