Skip to content
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

is there anyway to zoom in Viro360Images ? #655

Open
Ashkan-Oliaie opened this issue Jun 15, 2019 · 3 comments
Open

is there anyway to zoom in Viro360Images ? #655

Ashkan-Oliaie opened this issue Jun 15, 2019 · 3 comments

Comments

@Ashkan-Oliaie
Copy link

Environment

Please provide the following information about your environment:

  1. Development OS: Windows
  2. Device OS & Version: What Android OS version (6.0)
  3. Version: 2.14.0
  4. Device(s): Samsung Galaxy S6

Description

I need to add a pinch gesture to zoom in Viro360Images ,I've already managed to implement the rotation via panning , and I added a gesture that targets the position value of the camera but it's not working the way I expected.

this.camera.setNativeProps({
position:[ 0 , 0 , -newZoomLevel ]
})
I expected to at least be able to change the position of the camera but it doesn't function as it suppose to

@FrancoisBourree
Copy link

Hi, never tried for a Viro360Images, but used a onPinch for an image.

<ViroImage source={require('...')}
      scale={[1, 1, 1].map(x => x * this.state.pinchStateGlobal)}
      onPinch={this._onPinch}
/>

the function :

_onPinch(pinchState, scaleFactor, source) {
      console.log(e);
      if(pinchState == 2) {
        this.setState({
          pinchStateGlobal: scaleFactor,
        });
      }
}

the constructor :

constructor(props) {
    super(props);
    this._onPinch = this._onPinch.bind(this)
    this.state = {
        pinchStateGlobal: 1
    };
  }

This way, the onPinch() function will update the pinchStateGlobal in the state.
As the scale of the image depends of the pinchStateGlobal, it will scale up or down.
Worked for a basic image, hope it will help your for the 360 version

@impaler
Copy link

impaler commented Jul 9, 2019

@FrancoisBourree scale and onPinch are not in the props of Viro360Image this would be a great feature to have, I have seen users have the expectation to touch pan and pinch zoom on content like this.

@sanoopks
Copy link

sanoopks commented Dec 7, 2022

You can adjust fieldOfView property of ViroCamera component, which will give you the expected result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants