Only move/resize windows with primary mouse button
Closes #578 Closes #579
This commit is contained in:
parent
07196158c9
commit
e31312cf7a
2 changed files with 8 additions and 1 deletions
|
@ -533,6 +533,12 @@ fn interact(
|
||||||
|
|
||||||
fn move_and_resize_window(ctx: &Context, window_interaction: &WindowInteraction) -> Option<Rect> {
|
fn move_and_resize_window(ctx: &Context, window_interaction: &WindowInteraction) -> Option<Rect> {
|
||||||
window_interaction.set_cursor(ctx);
|
window_interaction.set_cursor(ctx);
|
||||||
|
|
||||||
|
// Only move/resize windows with primary mouse button:
|
||||||
|
if !ctx.input().pointer.primary_down() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let pointer_pos = ctx.input().pointer.interact_pos()?;
|
let pointer_pos = ctx.input().pointer.interact_pos()?;
|
||||||
let mut rect = window_interaction.start_rect; // prevent drift
|
let mut rect = window_interaction.start_rect; // prevent drift
|
||||||
|
|
||||||
|
@ -586,7 +592,7 @@ fn window_interaction(
|
||||||
if window_interaction.is_none() {
|
if window_interaction.is_none() {
|
||||||
if let Some(hover_window_interaction) = resize_hover(ctx, possible, area_layer_id, rect) {
|
if let Some(hover_window_interaction) = resize_hover(ctx, possible, area_layer_id, rect) {
|
||||||
hover_window_interaction.set_cursor(ctx);
|
hover_window_interaction.set_cursor(ctx);
|
||||||
if ctx.input().pointer.any_pressed() && ctx.input().pointer.any_down() {
|
if ctx.input().pointer.any_pressed() && ctx.input().pointer.primary_down() {
|
||||||
ctx.memory().interaction.drag_id = Some(id);
|
ctx.memory().interaction.drag_id = Some(id);
|
||||||
ctx.memory().interaction.drag_is_window = true;
|
ctx.memory().interaction.drag_is_window = true;
|
||||||
window_interaction = Some(hover_window_interaction);
|
window_interaction = Some(hover_window_interaction);
|
||||||
|
|
|
@ -248,6 +248,7 @@ impl CtxRef {
|
||||||
// This is needed because we do window interaction first (to prevent frame delay),
|
// This is needed because we do window interaction first (to prevent frame delay),
|
||||||
// and then do content layout.
|
// and then do content layout.
|
||||||
if sense.drag
|
if sense.drag
|
||||||
|
&& self.input().pointer.primary_down()
|
||||||
&& (memory.interaction.drag_id.is_none()
|
&& (memory.interaction.drag_id.is_none()
|
||||||
|| memory.interaction.drag_is_window)
|
|| memory.interaction.drag_is_window)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue