This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRotationHolder.js
64 lines (59 loc) · 2.16 KB
/
RotationHolder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React from 'react';
import {
Text,
Plane
} from 'react-360';
function upInputEvent(ev){
return ev.nativeEvent.inputEvent.action == "up"
}
export const RotationHolder = ({rotationOnChange,
rotation,
rotationName,
rotationUpSuffix,
rotationDownSuffix,
transform}) =>(
<Plane>
<Text
style={{
backgroundColor: '#777899',
fontSize: 0.1,
layoutOrigin: [0.5, 0.5],
paddingLeft: 0.2,
paddingRight: 0.2,
textAlign: 'center',
textAlignVertical: 'center',
transform,
}}
onInput={(ev)=>{upInputEvent(ev) ? rotationOnChange(1) : null}}
>
{rotationName} {rotationUpSuffix}
</Text>
<Text
style={{
backgroundColor: '#777899',
fontSize: 0.1,
layoutOrigin: [0.5, 0.5],
paddingLeft: 0.2,
paddingRight: 0.2,
textAlign: 'center',
textAlignVertical: 'center',
transform,
}}
onInput={(ev)=>{upInputEvent(ev) ? rotationOnChange(-1) : null}}
>
{rotationName} {rotationDownSuffix}
</Text>
<Text
style={{
backgroundColor: '#777899',
fontSize: 0.1,
layoutOrigin: [0.5, 0.5],
paddingLeft: 0.2,
paddingRight: 0.2,
textAlign: 'center',
textAlignVertical: 'center',
transform,
}}
>{rotation}</Text>
</Plane>
);