Skip to content

Confused by deltaX and deltaY #157

@lhnrd

Description

@lhnrd

Documentation:

{
  event,          // source event
  deltaX,         // x offset (current.x - initial.x)
  deltaY,         // y offset (current.y - initial.y)
  absX,           // absolute deltaX
  absY,           // absolute deltaY
  velocity,       // √(absX^2 + absY^2) / time
  dir,            // direction of swipe (Left|Right|Up|Down)
}

Codebase:

const { clientX, clientY } = event.touches ? event.touches[0] : event
const [x, y] = rotateXYByAngle([clientX, clientY], props.rotationAngle)
const deltaX = state.xy[0] - x
const deltaY = state.xy[1] - y

My question here is, are clientX and clientY the current x and y coordinates of the mouse?
The docs says current.x minus initial.x, I was expecting that a mouse movement from left to right returns a positive value, but it's the opposite.

Am I getting something wrong here?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions