Closing many tickets

This commit is contained in:
John Lyon-Smith
2018-04-22 15:22:36 -07:00
parent 4bc0a6cd30
commit 5cb13f7498
31 changed files with 392 additions and 100 deletions

View File

@@ -14,26 +14,20 @@ import {
} from "react-viro"
import autobind from "autobind-decorator"
import backImage from "./images/back.png"
const styles = {
buttons: {
height: 80,
width: 80,
},
}
import { config } from "../config"
const shapes = {
hardhat: {
shape: require("./models/hardhat_obj.obj"),
materials: [require("./models/hardhat.mtl")],
order: {
source: require("./models/hardhat_obj.obj"),
resources: [require("./models/hardhat.mtl")],
},
question: {
shape: require("./models/question_obj.obj"),
materials: [require("./models/question.mtl")],
complaint: {
source: require("./models/question_obj.obj"),
resources: [require("./models/question.mtl")],
},
clipboard: {
shape: require("./models/clipboard_obj.obj"),
materials: [require("./models/clipboard.mtl")],
inspection: {
source: require("./models/clipboard_obj.obj"),
resources: [require("./models/clipboard.mtl")],
},
}
const distance = (vectorA, vectorB) => {
@@ -139,11 +133,16 @@ class WorkItemSceneAR extends React.Component {
@autobind
handleClick(position, source) {
// this.props.history.replace("/activity")
const { workItemId } = this.props
this.props.history.replace(
`/activity${workItemId ? "?workItemId=" + workItemId : ""}`
)
}
render() {
const { position, scale, rotation, shouldBillboard } = this.state
const shape = shapes[this.props.workItemType]
return (
<ViroARScene ref={(ref) => (this.arScene = ref)}>
@@ -165,14 +164,16 @@ class WorkItemSceneAR extends React.Component {
shadowFarZ={6}
shadowOpacity={0.9}
/>
<Viro3DObject
position={[0, 0, -1]}
source={shapes["hardhat"].shape}
resources={shapes["hardhat"].materials}
type="OBJ"
onLoadEnd={this.handleLoadEnd}
onClick={this.handleClick}
/>
{shape && (
<Viro3DObject
position={[0, 0, -1]}
source={shape.source}
resources={shape.resources}
type="OBJ"
onLoadEnd={this.handleLoadEnd}
onClick={this.handleClick}
/>
)}
<ViroSurface
rotation={[-90, 0, 0]}
position={[0, -0.001, 0]}
@@ -190,6 +191,15 @@ class WorkItemSceneAR extends React.Component {
export class ARViewer extends React.Component {
constructor(props) {
super(props)
const { search } = this.props.location
if (search) {
const params = new URLSearchParams(search)
this.workItemId = params.get("workItemId")
this.workItemType = params.get("workItemType")
}
}
@autobind
@@ -202,13 +212,23 @@ export class ARViewer extends React.Component {
<View style={{ width: "100%", height: "100%" }}>
<ViroARSceneNavigator
style={{ width: "100%", height: "100%" }}
apiKey="06F37B6A-74DA-4A83-965A-7DE2209A5C46"
initialScene={{ scene: WorkItemSceneAR }}
apiKey={config.viroAPIKey}
initialScene={{
scene: WorkItemSceneAR,
passProps: {
history: this.props.history,
workItemId: this.workItemId,
workItemType: this.workItemType,
},
}}
/>
<View style={{ position: "absolute", left: 30, right: 0, top: 50 }}>
<TouchableHighlight
style={styles.buttons}
style={{
height: 80,
width: 80,
}}
onPress={this.handleBackPress}
underlayColor={"#00000000"}>
<Image source={backImage} />