javascript - 有没有办法为 react-viro 360-image 组件添加垂直旋转平移?
问题描述
我需要为我一直在 react-native 开发的应用程序添加垂直旋转平移到 react-viro 相机,在两个月内我还没有找到解决这个问题的方法,这是我的第一次应用程序开发经验,是否可行让它以任何方式工作?
根据https://github.com/viromedia/viro/issues/103,我设法添加了水平旋转和错误的垂直旋转, 他们在这里说垂直平移触发了一些我无法解决的错误问题处理。
setPanAndZoom=(gesture,isPanning)=>{
// this.setState({panning:true});
let distanceX=gesture.x0-gesture.moveX;
let normalVectorX=distanceX/this.screenWidth;
let newAngleX=normalVectorX*this.rotateSensivity;
let distanceY=gesture.y0-gesture.moveY;
let normalVectorY=distanceY/this.screenWidth;
let newAngleY=normalVectorY*this.rotateSensivity;
if(isPanning){
this.camera.setNativeProps({
rotation:[this.currentAngleY+newAngleY,this.currentAngleX+newAngleX,0]
})
} else
{
this.currentAngleX=this.currentAngleX+newAngleX;
this.currentAngleY=this.currentAngleY+newAngleY;
}
}
this.pan=PanResponder.create({
onStartShouldSetPanResponder:()=>{
return true
},
onPanResponderMove:(event,gesture)=>{
this.setPanAndZoom(gesture,true)
},
onPanResponderRelease:(event,gesture)=>{
this.setPanAndZoom(gesture,false)
},
})
正如他们自己所说,垂直旋转似乎并不完美
解决方案
推荐阅读
- github - “这种比较需要很长时间才能产生。” github上的错误
- minikube - 如何在 Minikube VM (KVM2) 中获得包管理器?
- azure-cli2 - 多个 DevOps REST 方法抛出“命令失败并出现意外错误”
- laravel - 带有 csrf 的 Laravel Yajra 数据表操作按钮仍然抛出 419
- node.js - 对象未在 ejs 文件中解析
- java - Akka 引用随着 Play 框架不断增加
- ios - 金属着色器确定凸四边形内的点
- spring-data-jpa - Postgresql jsonb 运算符不使用 spring data jpa
- reactjs - 如何使用 reactjs 中的输入将数据添加到数组中?
- java - 如何使用 testNG 在测试中运行已经创建的 Java 程序?