Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-openspace committed Dec 3, 2024
1 parent 3d2003d commit 715e841
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/commonjs/ReactNativeZoomableView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/commonjs/ReactNativeZoomableView.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions lib/module/ReactNativeZoomableView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/module/ReactNativeZoomableView.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions lib/typescript/ReactNativeZoomableView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ declare class ReactNativeZoomableView extends Component<ReactNativeZoomableViewP
* @return {bool}
*/
zoomTo(newZoomLevel: number): boolean;
/**
* Sets zoom relative to a "zoom subject" which is the relative coordinates
* of the view
*/
zoomToZoomSubject(x: number, y: number, newZoomLevel: number): false | undefined;
/**
* Zooms in or out by a specified change level
* Use a positive number for `zoomLevelChange` to zoom in
Expand Down
15 changes: 15 additions & 0 deletions src/ReactNativeZoomableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,21 @@ class ReactNativeZoomableView extends Component<
return true;
}

/**
* Sets zoom relative to a "zoom subject" which is the relative coordinates
* of the view
*/
zoomToZoomSubject(x: number, y: number, newZoomLevel: number) {
if (
// if we would go out of our min/max limits -> abort
(this.props.maxZoom && newZoomLevel > this.props.maxZoom) ||
(this.props.minZoom && newZoomLevel < this.props.minZoom)
)
return false;
// Just exposing _zoomToLocation
this._zoomToLocation(x, y, newZoomLevel);
}

/**
* Zooms in or out by a specified change level
* Use a positive number for `zoomLevelChange` to zoom in
Expand Down

0 comments on commit 715e841

Please sign in to comment.