mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
LibWeb: Expose the MouseEvent::{clientX, clientY} attributes
These provide the cursor coordinate within the viewport at which the event occurred (as opposed to the page relative coordinates exposed via offsetX, offsetY).
This commit is contained in:
parent
815934a95d
commit
ad8e2f481d
5 changed files with 16 additions and 8 deletions
|
@ -35,24 +35,28 @@ class MouseEvent final : public UIEvents::UIEvent {
|
|||
public:
|
||||
using WrapperType = Bindings::MouseEventWrapper;
|
||||
|
||||
static NonnullRefPtr<MouseEvent> create(const FlyString& event_name, i32 offset_x, i32 offset_y)
|
||||
static NonnullRefPtr<MouseEvent> create(const FlyString& event_name, i32 offset_x, i32 offset_y, i32 client_x, i32 client_y)
|
||||
{
|
||||
return adopt(*new MouseEvent(event_name, offset_x, offset_y));
|
||||
return adopt(*new MouseEvent(event_name, offset_x, offset_y, client_x, client_y));
|
||||
}
|
||||
|
||||
virtual ~MouseEvent() override;
|
||||
|
||||
i32 offset_x() const { return m_offset_x; }
|
||||
i32 offset_y() const { return m_offset_y; }
|
||||
i32 client_x() const { return m_client_x; }
|
||||
i32 client_y() const { return m_client_y; }
|
||||
|
||||
protected:
|
||||
MouseEvent(const FlyString& event_name, i32 offset_x, i32 offset_y);
|
||||
MouseEvent(const FlyString& event_name, i32 offset_x, i32 offset_y, i32 client_x, i32 client_y);
|
||||
|
||||
private:
|
||||
void set_event_characteristics();
|
||||
|
||||
i32 m_offset_x { 0 };
|
||||
i32 m_offset_y { 0 };
|
||||
i32 m_client_x { 0 };
|
||||
i32 m_client_y { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue