Fix bugs and issues before first production build
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { StyleSheet, View, TouchableHighlight, Image } from 'react-native'
|
||||
import React from "react"
|
||||
import { StyleSheet, View, TouchableHighlight, Image } from "react-native"
|
||||
import {
|
||||
ViroARSceneNavigator,
|
||||
ViroARScene,
|
||||
@@ -10,62 +10,75 @@ import {
|
||||
ViroSpotLight,
|
||||
Viro3DObject,
|
||||
ViroSurface,
|
||||
} from 'react-viro'
|
||||
import autobind from 'autobind-decorator'
|
||||
import backImage from './images/back.png'
|
||||
} from "react-viro"
|
||||
import autobind from "autobind-decorator"
|
||||
import backImage from "./images/back.png"
|
||||
|
||||
const styles = {
|
||||
buttons : {
|
||||
buttons: {
|
||||
height: 80,
|
||||
width: 80,
|
||||
},
|
||||
}
|
||||
|
||||
const shapes = {
|
||||
hardhat: { shape: require('./models/hardhat.obj'), materials: [ require('./models/hardhat.mtl') ] },
|
||||
question: { shape: require('./models/question.obj'), materials: [ require('./models/question.mtl') ] },
|
||||
clipboard: { shape: require('./models/question.obj'), materials: [ require('./models/clipboard.mtl') ] },
|
||||
// hardhat: {
|
||||
// shape: require("./models/hardhat.obj"),
|
||||
// materials: [require("./models/hardhat.mtl")],
|
||||
// },
|
||||
// question: {
|
||||
// shape: require("./models/question.obj"),
|
||||
// materials: [require("./models/question.mtl")],
|
||||
// },
|
||||
// clipboard: {
|
||||
// shape: require("./models/clipboard.obj"),
|
||||
// materials: [require("./models/clipboard.mtl")],
|
||||
// },
|
||||
}
|
||||
|
||||
class WorkItemSceneAR extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
position: [0, .2, 0],
|
||||
scale: [.2, .2, .2],
|
||||
position: [0, 0.2, 0],
|
||||
scale: [0.2, 0.2, 0.2],
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ViroARScene>
|
||||
<ViroAmbientLight color="#ffffff" intensity={200}/>
|
||||
<ViroAmbientLight color="#ffffff" intensity={200} />
|
||||
<ViroARPlane>
|
||||
<ViroNode
|
||||
visible={true}
|
||||
position={this.state.position}
|
||||
scale={this.state.scale}
|
||||
key='hardhat'>
|
||||
key="hardhat">
|
||||
<ViroSpotLight
|
||||
innerAngle={5}
|
||||
outerAngle={20}
|
||||
direction={[0, -1 ,0]}
|
||||
direction={[0, -1, 0]}
|
||||
position={[0, 4, 0]}
|
||||
color="#ffffff"
|
||||
castsShadow={true}
|
||||
shadowNearZ={.1}
|
||||
shadowNearZ={0.1}
|
||||
shadowFarZ={6}
|
||||
shadowOpacity={.9} />
|
||||
shadowOpacity={0.9}
|
||||
/>
|
||||
<Viro3DObject
|
||||
position={[0, 0, 0]}
|
||||
source={shapes['hardhat'].shape}
|
||||
type = "OBJ" />
|
||||
source={shapes["hardhat"].shape}
|
||||
type="OBJ"
|
||||
/>
|
||||
<ViroSurface
|
||||
rotation={[-90, 0, 0]}
|
||||
position={[0, -.001, 0]}
|
||||
width={2.5} height={2.5}
|
||||
position={[0, -0.001, 0]}
|
||||
width={2.5}
|
||||
height={2.5}
|
||||
arShadowReceiver={true}
|
||||
ignoreEventHandling={true} />
|
||||
ignoreEventHandling={true}
|
||||
/>
|
||||
</ViroNode>
|
||||
</ViroARPlane>
|
||||
</ViroARScene>
|
||||
@@ -76,23 +89,27 @@ class WorkItemSceneAR extends React.Component {
|
||||
export class ARViewer extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
_handlePress() {
|
||||
this.props.history.replace('/')
|
||||
this.props.history.replace("/")
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ width: '100%', height: '100%' }} >
|
||||
<View style={{ width: "100%", height: "100%" }}>
|
||||
<ViroARSceneNavigator
|
||||
style={{ width: '100%', height: '100%' }}
|
||||
apiKey='06F37B6A-74DA-4A83-965A-7DE2209A5C46'
|
||||
initialScene={{ scene: WorkItemSceneAR }} />
|
||||
style={{ width: "100%", height: "100%" }}
|
||||
apiKey="06F37B6A-74DA-4A83-965A-7DE2209A5C46"
|
||||
initialScene={{ scene: WorkItemSceneAR }}
|
||||
/>
|
||||
|
||||
<View style={{position: 'absolute', left: 30, right: 0, top: 50}}>
|
||||
<TouchableHighlight style={styles.buttons} onPress={this._handlePress} underlayColor={'#00000000'} >
|
||||
<View style={{ position: "absolute", left: 30, right: 0, top: 50 }}>
|
||||
<TouchableHighlight
|
||||
style={styles.buttons}
|
||||
onPress={this._handlePress}
|
||||
underlayColor={"#00000000"}>
|
||||
<Image source={backImage} />
|
||||
</TouchableHighlight>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user