x in client (viewport) coordinates
the left edge of the box in client coordinates
the width of the box
right-to-left
px from the start of the box
host.addEventListener("pointerdown", e => {
const r = host.getBoundingClientRect();
console.info(toLogicalX(e.clientX, r.left + host.clientLeft, host.clientWidth, true)); // px from the right edge
});
1.1.98
A client x coordinate (e.g.
PointerEvent.clientX) as position in a box measured from the box's start: left-to-right from its left edge, right-to-left from its right edge.