Revert "scrolling: use display scale factor on pixel scroll"
This reverts commit 32d490b16c
.
This commit is contained in:
parent
32d490b16c
commit
a0c10abe80
4 changed files with 5 additions and 9 deletions
|
@ -285,10 +285,10 @@ impl ScrollDelta {
|
|||
ScrollDelta::Lines(delta) => point(line_height * delta.x, line_height * delta.y),
|
||||
}
|
||||
}
|
||||
|
||||
/// Combines two scroll deltas into one.
|
||||
pub fn coalesce(self, other: ScrollDelta) -> ScrollDelta {
|
||||
match (self, other) {
|
||||
// second time
|
||||
(ScrollDelta::Pixels(px_a), ScrollDelta::Pixels(px_b)) => {
|
||||
ScrollDelta::Pixels(px_a + px_b)
|
||||
}
|
||||
|
|
|
@ -86,7 +86,6 @@ impl PlatformInput {
|
|||
pub(crate) unsafe fn from_native(
|
||||
native_event: id,
|
||||
window_height: Option<Pixels>,
|
||||
scale_factor: Option<f32>,
|
||||
) -> Option<Self> {
|
||||
let event_type = native_event.eventType();
|
||||
|
||||
|
@ -175,7 +174,7 @@ impl PlatformInput {
|
|||
);
|
||||
|
||||
let delta = if native_event.hasPreciseScrollingDeltas() == YES {
|
||||
ScrollDelta::Pixels(raw_data.map(|p| px(p * scale_factor.unwrap_or(2.))))
|
||||
ScrollDelta::Pixels(raw_data.map(px))
|
||||
} else {
|
||||
ScrollDelta::Lines(raw_data)
|
||||
};
|
||||
|
|
|
@ -981,7 +981,7 @@ unsafe fn get_mac_platform(object: &mut Object) -> &MacPlatform {
|
|||
|
||||
extern "C" fn send_event(this: &mut Object, _sel: Sel, native_event: id) {
|
||||
unsafe {
|
||||
if let Some(event) = PlatformInput::from_native(native_event, None, None) {
|
||||
if let Some(event) = PlatformInput::from_native(native_event, None) {
|
||||
let platform = get_mac_platform(this);
|
||||
let mut lock = platform.0.lock();
|
||||
if let Some(mut callback) = lock.event.take() {
|
||||
|
|
|
@ -1102,7 +1102,7 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
|
|||
let mut lock = window_state.as_ref().lock();
|
||||
|
||||
let window_height = lock.content_size().height;
|
||||
let event = unsafe { PlatformInput::from_native(native_event, Some(window_height), None) };
|
||||
let event = unsafe { PlatformInput::from_native(native_event, Some(window_height)) };
|
||||
|
||||
if let Some(PlatformInput::KeyDown(event)) = event {
|
||||
// For certain keystrokes, macOS will first dispatch a "key equivalent" event.
|
||||
|
@ -1195,10 +1195,7 @@ extern "C" fn handle_view_event(this: &Object, _: Sel, native_event: id) {
|
|||
let is_active = unsafe { lock.native_window.isKeyWindow() == YES };
|
||||
|
||||
let window_height = lock.content_size().height;
|
||||
let scale_factor = lock.scale_factor();
|
||||
let event = unsafe {
|
||||
PlatformInput::from_native(native_event, Some(window_height), Some(scale_factor))
|
||||
};
|
||||
let event = unsafe { PlatformInput::from_native(native_event, Some(window_height)) };
|
||||
|
||||
if let Some(mut event) = event {
|
||||
match &mut event {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue