Fixed bug in mouse handler attaching
This commit is contained in:
parent
aed7c9bcfd
commit
c42bf1c50b
1 changed files with 18 additions and 16 deletions
|
@ -499,23 +499,10 @@ impl TerminalEl {
|
||||||
cx.dispatch_action(DeployContextMenu { position });
|
cx.dispatch_action(DeployContextMenu { position });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
);
|
||||||
//This handles both drag mode and mouse motion mode
|
|
||||||
//Mouse Move TODO
|
|
||||||
//This cannot be done conditionally for unknown reasons. Pending drag and drop rework.
|
|
||||||
//This also does not fire on right-mouse-down-move events wild.
|
|
||||||
.on_move(move |event, cx| {
|
|
||||||
if cx.is_parent_view_focused() {
|
|
||||||
if let Some(conn_handle) = connection.upgrade(cx.app) {
|
|
||||||
conn_handle.update(cx.app, |terminal, cx| {
|
|
||||||
terminal.mouse_move(&event, origin);
|
|
||||||
cx.notify();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if mode.contains(TermMode::MOUSE_MODE) {
|
//All mouse modes need the extra click handlers
|
||||||
|
if mode.intersects(TermMode::MOUSE_MODE) {
|
||||||
region = region
|
region = region
|
||||||
.on_down(
|
.on_down(
|
||||||
MouseButton::Right,
|
MouseButton::Right,
|
||||||
|
@ -558,6 +545,21 @@ impl TerminalEl {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
//Mouse move manages both dragging and motion events
|
||||||
|
if mode.intersects(TermMode::MOUSE_DRAG | TermMode::MOUSE_MOTION) {
|
||||||
|
region = region
|
||||||
|
//This does not fire on right-mouse-down-move events wild.
|
||||||
|
.on_move(move |event, cx| {
|
||||||
|
if cx.is_parent_view_focused() {
|
||||||
|
if let Some(conn_handle) = connection.upgrade(cx.app) {
|
||||||
|
conn_handle.update(cx.app, |terminal, cx| {
|
||||||
|
terminal.mouse_move(&event, origin);
|
||||||
|
cx.notify();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Mouse drag isn't correct
|
//TODO: Mouse drag isn't correct
|
||||||
//TODO: Nor is mouse motion. Move events aren't happening??
|
//TODO: Nor is mouse motion. Move events aren't happening??
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue