offsetX
offsetX is a property of mouse and pointer events that provides the horizontal coordinate of the pointer relative to the padding edge of the element that received the event. It is typically expressed in CSS pixels and is commonly used in drawing and hit-testing scenarios, such as determining where a user clicked or moved the mouse inside a canvas element.
In practice, offsetX is defined as a coordinate on the event’s target element. This means the value
There are important caveats. offsetX and offsetY are not uniformly defined for all input types, and touch
Most developers avoid relying solely on offsetX for robust coordinate calculations. A common approach is to