Skip to content

Commit

Permalink
Fix move static pin function
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottkember committed Feb 24, 2024
1 parent c90bab7 commit 1493d09
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/ReactNativeZoomableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,15 @@ class ReactNativeZoomableView extends Component<
const tapY =
this.props.staticPinPosition.y - this.doubleTapFirstTap.y;

this.moveStaticPinTo({
x: this.offsetX + tapX / this.zoomLevel,
y: this.offsetY + tapY / this.zoomLevel,
Animated.timing(this.panAnim, {
toValue: {
x: this.offsetX + tapX / this.zoomLevel,
y: this.offsetY + tapY / this.zoomLevel,
},
useNativeDriver: true,
duration: 200,
}).start(() => {
this._updateStaticPin();
});
}

Expand All @@ -898,7 +904,10 @@ class ReactNativeZoomableView extends Component<

moveStaticPinTo = (position: Vec2D) => {
Animated.timing(this.panAnim, {
toValue: position,
toValue: {
x: this.props.staticPinPosition.x - position.x / this.zoomLevel,
y: this.props.staticPinPosition.y - position.y / this.zoomLevel,
},
useNativeDriver: true,
duration: 200,
}).start(() => {
Expand Down Expand Up @@ -1208,3 +1217,5 @@ const styles = StyleSheet.create({
});

export default ReactNativeZoomableView;

export { ReactNativeZoomableView };

0 comments on commit 1493d09

Please sign in to comment.