MCPcopy Create free account
hub / github.com/StrataWM/strata / pointer_axis

Method pointer_axis

src/handlers/input.rs:2722–2750  ·  view source on GitHub ↗
(
		&mut self,
		event: I::PointerAxisEvent,
	)

Source from the content-addressed store, hash-verified

2720 }
2721
2722 pub fn pointer_axis<I: InputBackend>(
2723 &mut self,
2724 event: I::PointerAxisEvent,
2725 ) -> anyhow::Result<()> {
2726 let horizontal_amount = event
2727 .amount(Axis::Horizontal)
2728 .unwrap_or_else(|| event.amount(Axis::Horizontal).unwrap_or(0.0) * 3.0);
2729 let vertical_amount = event
2730 .amount(Axis::Vertical)
2731 .unwrap_or_else(|| event.amount(Axis::Vertical).unwrap_or(0.0) * 3.0);
2732
2733 let mut frame = AxisFrame::new(event.time_msec()).source(event.source());
2734 if horizontal_amount != 0.0 {
2735 frame = frame.value(Axis::Horizontal, horizontal_amount);
2736 } else if event.source() == AxisSource::Finger {
2737 frame = frame.stop(Axis::Horizontal);
2738 }
2739 if vertical_amount != 0.0 {
2740 frame = frame.value(Axis::Vertical, vertical_amount);
2741 } else if event.source() == AxisSource::Finger {
2742 frame = frame.stop(Axis::Vertical);
2743 }
2744
2745 if let Some(ptr) = self.seat.get_pointer() {
2746 ptr.axis(self, frame);
2747 }
2748
2749 Ok(())
2750 }
2751}

Callers

nothing calls this directly

Calls 1

axisMethod · 0.80

Tested by

no test coverage detected