-
-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PointerTracker
refactor.
#2931
PointerTracker
refactor.
#2931
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -405,10 +405,9 @@ export default abstract class GestureHandler implements IGestureHandler { | |
nativeEvent: { | ||
numberOfPointers: this.tracker.getTrackedPointersCount(), | ||
state: newState, | ||
pointerInside: this.delegate.isPointerInBounds({ | ||
x: this.tracker.getLastAvgX(), | ||
y: this.tracker.getLastAvgY(), | ||
}), | ||
pointerInside: this.delegate.isPointerInBounds( | ||
this.tracker.getAbsoluteCoordsAverage() | ||
), | ||
...this.transformNativeEvent(), | ||
handlerTag: this.handlerTag, | ||
target: this.viewRef, | ||
|
@@ -442,10 +441,10 @@ export default abstract class GestureHandler implements IGestureHandler { | |
|
||
all.push({ | ||
id: id, | ||
x: element.lastX - rect.pageX, | ||
y: element.lastY - rect.pageY, | ||
absoluteX: element.lastX, | ||
absoluteY: element.lastY, | ||
x: element.abosoluteCoords.x - rect.pageX, | ||
y: element.abosoluteCoords.y - rect.pageY, | ||
absoluteX: element.abosoluteCoords.x, | ||
absoluteY: element.abosoluteCoords.y, | ||
}); | ||
}); | ||
|
||
|
@@ -465,10 +464,10 @@ export default abstract class GestureHandler implements IGestureHandler { | |
|
||
changed.push({ | ||
id: id, | ||
x: element.lastX - rect.pageX, | ||
y: element.lastY - rect.pageY, | ||
absoluteX: element.lastX, | ||
absoluteY: element.lastY, | ||
x: element.abosoluteCoords.x - rect.pageX, | ||
y: element.abosoluteCoords.y - rect.pageY, | ||
Comment on lines
+467
to
+468
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
absoluteX: element.abosoluteCoords.x, | ||
absoluteY: element.abosoluteCoords.y, | ||
}); | ||
}); | ||
} | ||
|
@@ -534,18 +533,18 @@ export default abstract class GestureHandler implements IGestureHandler { | |
|
||
all.push({ | ||
id: id, | ||
x: element.lastX - rect.pageX, | ||
y: element.lastY - rect.pageY, | ||
absoluteX: element.lastX, | ||
absoluteY: element.lastY, | ||
x: element.abosoluteCoords.x - rect.pageX, | ||
y: element.abosoluteCoords.y - rect.pageY, | ||
Comment on lines
+536
to
+537
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
absoluteX: element.abosoluteCoords.x, | ||
absoluteY: element.abosoluteCoords.y, | ||
}); | ||
|
||
changed.push({ | ||
id: id, | ||
x: element.lastX - rect.pageX, | ||
y: element.lastY - rect.pageY, | ||
absoluteX: element.lastX, | ||
absoluteY: element.lastY, | ||
x: element.abosoluteCoords.x - rect.pageX, | ||
y: element.abosoluteCoords.y - rect.pageY, | ||
Comment on lines
+544
to
+545
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
absoluteX: element.abosoluteCoords.x, | ||
absoluteY: element.abosoluteCoords.y, | ||
}); | ||
}); | ||
|
||
|
@@ -570,12 +569,13 @@ export default abstract class GestureHandler implements IGestureHandler { | |
protected transformNativeEvent(): Record<string, unknown> { | ||
// those properties are shared by most handlers and if not this method will be overriden | ||
const rect = this.delegate.measureView(); | ||
const lastCoords = this.tracker.getAbsoluteCoordsAverage(); | ||
|
||
return { | ||
x: this.tracker.getLastAvgX() - rect.pageX, | ||
y: this.tracker.getLastAvgY() - rect.pageY, | ||
absoluteX: this.tracker.getLastAvgX(), | ||
absoluteY: this.tracker.getLastAvgY(), | ||
x: lastCoords.x - rect.pageX, | ||
y: lastCoords.y - rect.pageY, | ||
Comment on lines
+575
to
+576
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
absoluteX: lastCoords.x, | ||
absoluteY: lastCoords.y, | ||
}; | ||
} | ||
|
||
|
@@ -720,8 +720,9 @@ export default abstract class GestureHandler implements IGestureHandler { | |
} | ||
|
||
const rect = this.delegate.measureView(); | ||
const offsetX: number = this.tracker.getLastX() - rect.pageX; | ||
const offsetY: number = this.tracker.getLastY() - rect.pageY; | ||
const { x, y } = this.tracker.getLastAbsoluteCoords(); | ||
const offsetX: number = x - rect.pageX; | ||
const offsetY: number = y - rect.pageY; | ||
Comment on lines
+723
to
+725
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like relative coords. However, the result may be different when the view is transformed. I'm not sure how Android/iOS does this, could you check that? |
||
|
||
if ( | ||
offsetX >= left && | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same