mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Implement WheelEvent Interface
Note: The WheelEvent interface supports rotation in all 3 spatial dimensions. This implementation only supports two due to limitations in the Glutin compositor. The wheelevent interface is a dom interface that triggers for any attached device that can rotate in one or more spatial dimensions. Traditionally this is the mouse wheel though other devices could be used as well. E.g. the trackball on a trackball mouse.
This commit is contained in:
parent
8f11b52d9a
commit
35bca991ad
16 changed files with 347 additions and 146 deletions
|
@ -10,7 +10,7 @@ use euclid::TypedScale;
|
|||
use gleam::gl;
|
||||
use keyboard_types::KeyboardEvent;
|
||||
use msg::constellation_msg::{PipelineId, TopLevelBrowsingContextId, TraversalDirection};
|
||||
use script_traits::{MouseButton, TouchEventType, TouchId};
|
||||
use script_traits::{MouseButton, TouchEventType, TouchId, WheelDelta};
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use servo_url::ServoUrl;
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
|
@ -65,6 +65,8 @@ pub enum WindowEvent {
|
|||
MouseWindowMoveEventClass(DevicePoint),
|
||||
/// Touch event: type, identifier, point
|
||||
Touch(TouchEventType, TouchId, DevicePoint),
|
||||
/// Sent when user moves the mouse wheel.
|
||||
Wheel(WheelDelta, DevicePoint),
|
||||
/// Sent when the user scrolls. The first point is the delta and the second point is the
|
||||
/// origin.
|
||||
Scroll(ScrollLocation, DeviceIntPoint, TouchEventType),
|
||||
|
@ -113,6 +115,7 @@ impl Debug for WindowEvent {
|
|||
WindowEvent::MouseWindowEventClass(..) => write!(f, "Mouse"),
|
||||
WindowEvent::MouseWindowMoveEventClass(..) => write!(f, "MouseMove"),
|
||||
WindowEvent::Touch(..) => write!(f, "Touch"),
|
||||
WindowEvent::Wheel(..) => write!(f, "Wheel"),
|
||||
WindowEvent::Scroll(..) => write!(f, "Scroll"),
|
||||
WindowEvent::Zoom(..) => write!(f, "Zoom"),
|
||||
WindowEvent::PinchZoom(..) => write!(f, "PinchZoom"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue