Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::web::ViewportMapping Struct Reference

Maps CSS pixels — the unit every browser pointer event reports — to root-view coordinates. More...

#include <web_event_translate.hpp>

Public Member Functions

bool has_design_viewport () const
bool transform (float &sx, float &sy, float &tx, float &ty) const
 Root → CSS transform, or false when no design viewport is active (identity; outputs untouched).

Public Attributes

float css_width = 0
float css_height = 0
float design_width = 0
float design_height = 0
bool top_align = false

Detailed Description

Maps CSS pixels — the unit every browser pointer event reports — to root-view coordinates.

HiDPI is deliberately absent from this transform. The canvas backing store is sized css * devicePixelRatio and Skia re-applies the same factor at paint time (SkiaSurface scale factor), so root coordinates stay in CSS pixels: dividing pointer coordinates by the ratio here would scale the input twice.

With a design viewport (design_width/design_height > 0) the root is pinned at design size and letterboxed into the canvas, exactly as the macOS GPU host does, so the mapping becomes the inverse of WindowHost::compute_design_viewport_transform().

Member Function Documentation

◆ has_design_viewport()

bool pulp::view::web::ViewportMapping::has_design_viewport ( ) const
inline

◆ transform()

bool pulp::view::web::ViewportMapping::transform ( float & sx,
float & sy,
float & tx,
float & ty ) const
inline

Root → CSS transform, or false when no design viewport is active (identity; outputs untouched).

Member Data Documentation

◆ css_height

float pulp::view::web::ViewportMapping::css_height = 0

◆ css_width

float pulp::view::web::ViewportMapping::css_width = 0

◆ design_height

float pulp::view::web::ViewportMapping::design_height = 0

◆ design_width

float pulp::view::web::ViewportMapping::design_width = 0

◆ top_align

bool pulp::view::web::ViewportMapping::top_align = false

The documentation for this struct was generated from the following file: