Skip to content

Commit 9a49f2d

Browse files
committed
Prevent touchscreen pointers from selecting text
1 parent 8eccb80 commit 9a49f2d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

packages/blitz-dom/src/events/pointer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ pub(crate) fn handle_pointermove<F: FnMut(DomEvent)>(
240240
.extend_selection_to_point(x as f32, y as f32);
241241

242242
changed = true;
243-
} else if buttons != MouseEventButtons::None && doc.extend_text_selection_to_point(x, y) {
243+
} else if event.is_mouse()
244+
&& buttons != MouseEventButtons::None
245+
&& doc.extend_text_selection_to_point(x, y)
246+
{
244247
changed = true;
245248
}
246249

packages/blitz-shell/src/convert_events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub(crate) fn pointer_source_to_blitz(source: &PointerSource) -> BlitzPointerId
7171
}
7272

7373
// TODO: TabletTool and Unknown events
74-
PointerSource::TabletTool { .. } => BlitzPointerId::Mouse,
74+
PointerSource::TabletTool { .. } => BlitzPointerId::Pen,
7575
PointerSource::Unknown => BlitzPointerId::Mouse,
7676
}
7777
}

packages/blitz-traits/src/events.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@ impl BlitzPointerEvent {
445445
matches!(self.id, BlitzPointerId::Mouse)
446446
}
447447
#[inline(always)]
448+
pub fn is_pen(&self) -> bool {
449+
matches!(self.id, BlitzPointerId::Pen)
450+
}
451+
#[inline(always)]
448452
pub fn is_finger(&self) -> bool {
449453
matches!(self.id, BlitzPointerId::Finger(_))
450454
}

0 commit comments

Comments
 (0)