question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confused by deltaX and deltaY

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
hartziscommented, Jul 29, 2019

@r-inaldi Thank you for posting the issue, you’ve absolutely found a discrepancy. The readme should say initial - current, I’ll get a small PR to update the docs. At least it looks like we’ve been consistent between v4 & v5.

I think you’re absolutely correct and we should be doing current - initial and I think that’s why the docs say that, but it looks like we just “copied” what we had in v4 to v5 in the code.

Going to make a note to make this change for v6 when we drop the <Swipeable /> component.

0reactions
hartziscommented, Sep 27, 2019

@psikoi thanks for the :poke:, i was keeping it open till i merged and deployed #162

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delta x / Delta y: Definition, Examples - Statistics How To
Delta y / delta y means "small changes", either on the x-axis or y-axis. It's not to be confused with the derivative, dy/dx....
Read more >
What is the difference between dy, del y and delta y? - Quora
Delta indicates “a small change” - so delta x means “a small change in x”. For slopes of lines, we take 2 points...
Read more >
The difference between $\Delta x$, $\delta x$ and $dx
dx is used to denote the derivative when you have a univariate function (when you just have x and there is no confusion)....
Read more >
Given y=f(x)=x^3-9x+5 find dy and delta y with x=1 ... - YouTube
Given y=f(x)=x^3-9x+5 find dy and delta y with x=1 and delta x =0.1. Watch later. Share. Copy link. Info. Shopping. Tap to unmute....
Read more >
[java] how to find the deltax and deltay to move a ball ... - Reddit
I know I'm supposed to use Math.toRadians(angle), Math.sin(theta) and Math.cos(theta), but using all of this to find the deltax and deltay is confusing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found