hide 3D controls if not using touch device

This commit is contained in:
HF 2020-02-02 02:43:43 +01:00
parent 7f7d054b37
commit a951bfaf86
3 changed files with 9 additions and 5 deletions

View File

@ -16,7 +16,7 @@ import HistorySelect from './HistorySelect';
import Mobile3DControls from './Mobile3DControls';
const UI = ({ isHistoricalView, is3D }) => {
const UI = ({ isHistoricalView, is3D, isOnMobile }) => {
if (isHistoricalView) {
return <HistorySelect />;
}
@ -25,7 +25,7 @@ const UI = ({ isHistoricalView, is3D }) => {
<PalselButton />
<Palette />
{(is3D) ? null : <GlobeButton />}
<Mobile3DControls />
{(isOnMobile) ? <Mobile3DControls /> : null}
<CoolDownBox />
<NotifyBox />
</div>
@ -37,9 +37,13 @@ function mapStateToProps(state: State) {
isHistoricalView,
is3D,
} = state.canvas;
const {
isOnMobile,
} = state.user;
return {
isHistoricalView,
is3D,
isOnMobile,
};
}

View File

@ -25,8 +25,7 @@ export type UserState = {
chatMessages: Array,
// minecraft
minecraftname: string,
// just gets set by 3D controls on
// on voxel canvases
// if user is using touchscreen
isOnMobile: boolean,
};

View File

@ -524,8 +524,9 @@ class Renderer {
const state = this.store.getState();
const {
placeAllowed,
isOnMobile,
} = state.user;
if (!placeAllowed) {
if (!placeAllowed || isOnMobile) {
return;
}