[Update] Config Page: VR Tab. Change the design.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import styles from "./Slider.module.scss";
|
||||
import MUI_Slider from "@mui/material/Slider";
|
||||
import { clsx } from "clsx";
|
||||
|
||||
export const Slider = (props) => {
|
||||
const [baseColor, setBaseColor] = useState("");
|
||||
@@ -17,7 +18,7 @@ export const Slider = (props) => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={clsx(styles.container, props.className)}>
|
||||
<MUI_Slider
|
||||
className={styles.range_slider}
|
||||
aria-label="Default"
|
||||
@@ -31,6 +32,7 @@ export const Slider = (props) => {
|
||||
marks={props.marks}
|
||||
track={props.track}
|
||||
orientation={props.orientation}
|
||||
valueLabelFormat={props.valueLabelFormat ? props.valueLabelFormat : null}
|
||||
sx={{
|
||||
color: baseColor,
|
||||
"& .MuiSlider-thumb": {
|
||||
@@ -43,18 +45,19 @@ export const Slider = (props) => {
|
||||
backgroundColor: toolTipColor,
|
||||
padding: "0.6rem 1rem",
|
||||
lineHeight: "1.15",
|
||||
top: "-1.4rem",
|
||||
"&::before": {
|
||||
left: "30%",
|
||||
width: "1rem",
|
||||
height: "1rem",
|
||||
clipPath: "polygon(50% 0, 100% 100%, 0 100%)",
|
||||
},
|
||||
// top: "-1.4rem",
|
||||
// "&::before": {
|
||||
// left: "30%",
|
||||
// width: "1rem",
|
||||
// height: "1rem",
|
||||
// clipPath: "polygon(50% 0, 100% 100%, 0 100%)",
|
||||
// },
|
||||
},
|
||||
},
|
||||
"& .MuiSlider-markLabel": {
|
||||
fontSize: "1.4rem",
|
||||
color: "white",
|
||||
whiteSpace: "nowrap",
|
||||
},
|
||||
"& .MuiSlider-markLabelActive": {
|
||||
color: activeColor,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
align-items: center; // 中央に揃え
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
padding-left: 4rem;
|
||||
// padding-left: 4rem;
|
||||
}
|
||||
|
||||
.range_slider {
|
||||
|
||||
@@ -1,21 +1,151 @@
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import styles from "./Vr.module.scss";
|
||||
import { Slider } from "../_components/";
|
||||
import { clsx } from "clsx";
|
||||
|
||||
export const Vr = () => {
|
||||
const { t } = useTranslation();
|
||||
const [is_opened_position_controller, setIsOpenedPositionController] = useState(true);
|
||||
|
||||
const toggleController = () => {
|
||||
setIsOpenedPositionController(!is_opened_position_controller);
|
||||
};
|
||||
|
||||
const toggle_button_class_names__position = clsx(styles.controller_type_switcher, {
|
||||
[styles.is_selected]: is_opened_position_controller
|
||||
});
|
||||
const toggle_button_class_names__rotation = clsx(styles.controller_type_switcher, {
|
||||
[styles.is_selected]: !is_opened_position_controller
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={styles.controller_type_switch} onClick={toggleController}>
|
||||
<div className={toggle_button_class_names__position}>
|
||||
<p className={styles.controller_switcher_label}>Position</p>
|
||||
</div>
|
||||
<div className={toggle_button_class_names__rotation}>
|
||||
<p className={styles.controller_switcher_label}>Rotation</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.position_rotation_controls_box}>
|
||||
{is_opened_position_controller
|
||||
? <PositionControls />
|
||||
: <RotationControls />
|
||||
}
|
||||
</div>
|
||||
<OtherControls />
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const PositionControls = () => {
|
||||
const { t } = useTranslation();
|
||||
const [position, setPosition] = useState({ x: 0, y: 0, z: 0 });
|
||||
const [rotation, setRotation] = useState({ rotate_x: 0, rotate_y: 0, rotate_z: 0 });
|
||||
const [opacity, setOpacity] = useState(1);
|
||||
const [ui_scaling, setUiScaling] = useState(100);
|
||||
|
||||
const handlePositionChange = (axis, value) => {
|
||||
setPosition((prev) => ({ ...prev, [axis]: value }));
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.position_controls}>
|
||||
<div className={styles.position_wrapper}>
|
||||
<label className={clsx(styles.slider_label, styles.x_position_label)}>{t("overlay_settings.x_position")}</label>
|
||||
<Slider
|
||||
className={styles.x_position_slider}
|
||||
variable={position.x}
|
||||
step={1}
|
||||
min={-100}
|
||||
max={100}
|
||||
onchangeFunction={(value) => handlePositionChange("x", value)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.position_wrapper}>
|
||||
<label className={clsx(styles.slider_label, styles.y_position_label)}>{t("overlay_settings.y_position")}</label>
|
||||
<Slider
|
||||
className={styles.y_position_slider}
|
||||
variable={position.y}
|
||||
step={1}
|
||||
min={-100}
|
||||
max={100}
|
||||
onchangeFunction={(value) => handlePositionChange("y", value)}
|
||||
orientation="vertical"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.position_wrapper}>
|
||||
<label className={clsx(styles.slider_label, styles.z_position_label)}>{t("overlay_settings.z_position")}</label>
|
||||
<Slider
|
||||
className={styles.z_position_slider}
|
||||
variable={position.z}
|
||||
step={1}
|
||||
min={-100}
|
||||
max={100}
|
||||
onchangeFunction={(value) => handlePositionChange("z", value)}
|
||||
orientation="vertical"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const RotationControls = () => {
|
||||
const { t } = useTranslation();
|
||||
const [rotation, setRotation] = useState({ rotate_x: 0, rotate_y: 0, rotate_z: 0 });
|
||||
|
||||
const handleRotationChange = (axis, value) => {
|
||||
setRotation((prev) => ({ ...prev, [axis]: value }));
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className={styles.rotation_controls}>
|
||||
<div className={styles.rotation_wrapper}>
|
||||
<label className={clsx(styles.slider_label, styles.x_rotation_label)}>{t("overlay_settings.x_rotation")}</label>
|
||||
<Slider
|
||||
className={styles.x_rotation_slider}
|
||||
variable={-rotation.rotate_x}
|
||||
valueLabelFormat={rotation.rotate_x}
|
||||
step={10}
|
||||
min={-180}
|
||||
max={180}
|
||||
onchangeFunction={(value) => handleRotationChange("rotate_x", -value)}
|
||||
orientation="vertical"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.rotation_wrapper}>
|
||||
<label className={clsx(styles.slider_label, styles.y_rotation_label)}>{t("overlay_settings.y_rotation")}</label>
|
||||
<Slider
|
||||
className={styles.y_rotation_slider}
|
||||
variable={rotation.rotate_y}
|
||||
step={10}
|
||||
min={-180}
|
||||
max={180}
|
||||
onchangeFunction={(value) => handleRotationChange("rotate_y", value)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.rotation_wrapper}>
|
||||
<label className={clsx(styles.slider_label, styles.z_rotation_label)}>{t("overlay_settings.z_rotation")}</label>
|
||||
<Slider
|
||||
className={styles.z_rotation_slider}
|
||||
variable={rotation.rotate_z}
|
||||
step={15}
|
||||
min={-180}
|
||||
max={180}
|
||||
onchangeFunction={(value) => handleRotationChange("rotate_z", value)}
|
||||
orientation="vertical"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
const OtherControls = () => {
|
||||
const { t } = useTranslation();
|
||||
const [opacity, setOpacity] = useState(1);
|
||||
const [ui_scaling, setUiScaling] = useState(100);
|
||||
|
||||
const handleOpacityChange = (value) => {
|
||||
setOpacity(value / 100);
|
||||
};
|
||||
@@ -24,126 +154,70 @@ export const Vr = () => {
|
||||
setUiScaling(value);
|
||||
};
|
||||
|
||||
const ui_variable_opacity = (opacity * 100).toFixed(0);
|
||||
|
||||
const scale = position.z >= 0
|
||||
? (1 - position.z / 200) * (ui_scaling / 100)
|
||||
: (1 + Math.abs(position.z) / 200) * (ui_scaling / 100);
|
||||
const [display_duration, setDisplayDuration] = useState(5);
|
||||
const [fadeout_duration, setFadeoutDuration] = useState(2);
|
||||
|
||||
const handleDisplayDurationChange = (value) => {
|
||||
setDisplayDuration(value);
|
||||
};
|
||||
|
||||
const handleFadeoutDurationChange = (value) => {
|
||||
setFadeoutDuration(value);
|
||||
};
|
||||
|
||||
|
||||
const x_factor = Math.min(Math.abs(position.x) / 100, 1);
|
||||
const y_factor = Math.min(Math.abs(position.y) / 100, 1);
|
||||
|
||||
const translate_x = position.x + (position.z * x_factor * (position.x >= 0 ? -1 : 1));
|
||||
const translate_y = -1 * (position.y + (position.z * y_factor * (position.y >= 0 ? -1 : 1)));
|
||||
|
||||
|
||||
return (
|
||||
<div className={styles.app}>
|
||||
<div className={styles.canvas_container}>
|
||||
<div className={styles.z_position}>
|
||||
<label>Z Position</label>
|
||||
<Slider
|
||||
variable={position.z}
|
||||
step={1}
|
||||
min={-100}
|
||||
max={100}
|
||||
onchangeFunction={(value) => handlePositionChange("z", value)}
|
||||
orientation="vertical"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.canvas}>
|
||||
<div
|
||||
className={styles.chat_box}
|
||||
style={{
|
||||
transform: `
|
||||
translate(${translate_x}px, ${translate_y}px)
|
||||
scale(${scale})
|
||||
rotateX(${rotation.rotate_x}deg)
|
||||
rotateY(${rotation.rotate_y}deg)
|
||||
rotateZ(${rotation.rotate_z}deg)
|
||||
`,
|
||||
opacity: opacity
|
||||
}}
|
||||
>
|
||||
<p className={styles.chat_text}>
|
||||
実際の表示とは大きく違います。これはただのイメージ図です。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.y_position}>
|
||||
<label>Y Position</label>
|
||||
<Slider
|
||||
variable={position.y}
|
||||
step={1}
|
||||
min={-100}
|
||||
max={100}
|
||||
onchangeFunction={(value) => handlePositionChange("y", value)}
|
||||
orientation="vertical"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.x_position}>
|
||||
<label>X Position</label>
|
||||
<Slider
|
||||
variable={position.x}
|
||||
step={1}
|
||||
min={-100}
|
||||
max={100}
|
||||
onchangeFunction={(value) => handlePositionChange("x", value)}
|
||||
/>
|
||||
</div>
|
||||
return(
|
||||
<div className={styles.other_controls}>
|
||||
<div className={styles.other_controls_wrapper}>
|
||||
<label className={clsx(styles.other_controls_slider_label, styles.opacity_label)}>{t("overlay_settings.opacity")}</label>
|
||||
<Slider
|
||||
className={clsx(styles.other_controls_slider, styles.opacity_slider)}
|
||||
variable={(opacity * 100)}
|
||||
valueLabelFormat={`${ui_variable_opacity}%`}
|
||||
step={5}
|
||||
min={10}
|
||||
max={100}
|
||||
onchangeFunction={handleOpacityChange}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.other_controls}>
|
||||
<div className={styles.x_rotation}>
|
||||
<label>X Rotation</label>
|
||||
<Slider
|
||||
variable={rotation.rotate_x}
|
||||
step={1}
|
||||
min={-180}
|
||||
max={180}
|
||||
onchangeFunction={(value) => handleRotationChange("rotate_x", value)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.y_rotation}>
|
||||
<label>Y Rotation</label>
|
||||
<Slider
|
||||
variable={rotation.rotate_y}
|
||||
step={1}
|
||||
min={-180}
|
||||
max={180}
|
||||
onchangeFunction={(value) => handleRotationChange("rotate_y", value)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.z_rotation}>
|
||||
<label>Z Rotation</label>
|
||||
<Slider
|
||||
variable={rotation.rotate_z}
|
||||
step={1}
|
||||
min={-180}
|
||||
max={180}
|
||||
onchangeFunction={(value) => handleRotationChange("rotate_z", value)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.opacity}>
|
||||
<label>Opacity</label>
|
||||
<Slider
|
||||
variable={opacity * 100}
|
||||
step={1}
|
||||
min={0}
|
||||
max={100}
|
||||
onchangeFunction={handleOpacityChange}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.ui_scaling}>
|
||||
<label>UI Scaling</label>
|
||||
<Slider
|
||||
variable={ui_scaling}
|
||||
step={1}
|
||||
min={40}
|
||||
max={200}
|
||||
onchangeFunction={handleUiScalingChange}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.other_controls_wrapper}>
|
||||
<label className={clsx(styles.other_controls_slider_label, styles.ui_scaling_label)}>{t("overlay_settings.ui_scaling")}</label>
|
||||
<Slider
|
||||
className={clsx(styles.other_controls_slider, styles.ui_scaling_slider)}
|
||||
variable={ui_scaling}
|
||||
valueLabelFormat={`${ui_scaling}%`}
|
||||
step={10}
|
||||
min={40}
|
||||
max={200}
|
||||
onchangeFunction={handleUiScalingChange}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.other_controls_wrapper}>
|
||||
<label className={clsx(styles.other_controls_slider_label, styles.display_duration_label)}>{t("overlay_settings.display_duration")}</label>
|
||||
<Slider
|
||||
className={clsx(styles.other_controls_slider, styles.display_duration_slider)}
|
||||
variable={display_duration}
|
||||
valueLabelFormat={`${display_duration} second(s)`}
|
||||
step={1}
|
||||
min={1}
|
||||
max={60}
|
||||
onchangeFunction={handleDisplayDurationChange}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.other_controls_wrapper}>
|
||||
<label className={clsx(styles.other_controls_slider_label, styles.fadeout_duration_label)}>{t("overlay_settings.fadeout_duration")}</label>
|
||||
<Slider
|
||||
className={clsx(styles.other_controls_slider, styles.fadeout_duration_slider)}
|
||||
variable={fadeout_duration}
|
||||
valueLabelFormat={`${fadeout_duration} second(s)`}
|
||||
step={1}
|
||||
min={0}
|
||||
max={5}
|
||||
onchangeFunction={handleFadeoutDurationChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
@@ -1,79 +1,182 @@
|
||||
.app {
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
margin-top: 4rem;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.canvas_container {
|
||||
display: flex;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.canvas {
|
||||
width: 40rem;
|
||||
height: 30rem;
|
||||
border: 0.1rem solid #fff;
|
||||
background-color: var(--dark_800_color);
|
||||
.controller_type_switch {
|
||||
display: flex;
|
||||
border: 0.1rem solid var(--dark_600_color);
|
||||
border-radius: 0.4rem;
|
||||
width: 50%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: var(--dark_600_color);
|
||||
&:hover {
|
||||
color: var(--dark_400_color);
|
||||
}
|
||||
}
|
||||
.controller_type_switcher {
|
||||
width: 100%;
|
||||
&.is_selected {
|
||||
background-color: var(--dark_850_color);
|
||||
}
|
||||
&.is_selected .controller_switcher_label {
|
||||
color: var(--dark_basic_text_color);
|
||||
}
|
||||
}
|
||||
.controller_switcher_label {
|
||||
padding: 1rem;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.position_rotation_controls_box {
|
||||
margin-top: 14rem;
|
||||
position: relative;
|
||||
aspect-ratio: 1 / 1;
|
||||
width: 36%;
|
||||
max-width: 40rem;
|
||||
transform: translate(-10%);
|
||||
}
|
||||
|
||||
.chat_box {
|
||||
max-width: 20rem;
|
||||
background-color: #33363a;
|
||||
border-radius: 0.4rem;
|
||||
padding: 1.2rem;
|
||||
position: absolute;
|
||||
transform-origin: center;
|
||||
transition: transform 0.1s ease-out, opacity 0.1s ease-out;
|
||||
}
|
||||
// .position_controls {
|
||||
// background-color: gray;
|
||||
// }
|
||||
|
||||
.chat_text {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
// .position_wrapper {
|
||||
// background-color: gray;
|
||||
// }
|
||||
|
||||
.x_position {
|
||||
position: absolute;
|
||||
bottom: -6rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
.slider_label {
|
||||
font-size: 1.6rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.y_position {
|
||||
.x_position_label {
|
||||
position: absolute;
|
||||
right: -8rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
writing-mode: vertical-rl;
|
||||
text-orientation: mixed;
|
||||
bottom: -4rem;
|
||||
right: -30%;
|
||||
text-align: end;
|
||||
}
|
||||
.y_position_label {
|
||||
position: absolute;
|
||||
top: -27%;
|
||||
left: 10%;
|
||||
}
|
||||
.z_position_label {
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
left: 80%;
|
||||
}
|
||||
|
||||
.x_position_slider {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 27%;
|
||||
width: 100%;
|
||||
height: 0%;
|
||||
}
|
||||
|
||||
.y_position_slider {
|
||||
position: absolute;
|
||||
bottom: 27%;
|
||||
left: 0;
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.z_position {
|
||||
.z_position_slider {
|
||||
position: absolute;
|
||||
left: -8rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
writing-mode: vertical-rl;
|
||||
text-orientation: mixed;
|
||||
bottom: 61%;
|
||||
left: 61%;
|
||||
transform: translate(50%,50%) rotate(45deg);
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// .rotation_controls {
|
||||
// background-color: gray;
|
||||
// }
|
||||
|
||||
// .rotation_wrapper {
|
||||
// background-color: gray;
|
||||
// }
|
||||
|
||||
.x_rotation_label {
|
||||
position: absolute;
|
||||
top: -27%;
|
||||
left: 10%;
|
||||
}
|
||||
.y_rotation_label {
|
||||
position: absolute;
|
||||
bottom: -4rem;
|
||||
right: -30%;
|
||||
text-align: end;
|
||||
}
|
||||
.z_rotation_label {
|
||||
position: absolute;
|
||||
top: -10%;
|
||||
right: -110%;
|
||||
}
|
||||
|
||||
.x_rotation_slider {
|
||||
position: absolute;
|
||||
bottom: 27%;
|
||||
left: 0;
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.y_rotation_slider {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 27%;
|
||||
width: 100%;
|
||||
height: 0%;
|
||||
}
|
||||
|
||||
.z_rotation_slider {
|
||||
position: absolute;
|
||||
bottom: 90%;
|
||||
left: 100%;
|
||||
transform: translate(50%,50%) rotate(-45deg);
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.other_controls {
|
||||
margin-top: 10rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
gap: 2rem;
|
||||
width: 100%;
|
||||
max-width: 56rem;
|
||||
}
|
||||
|
||||
.x_rotation, .y_rotation, .z_rotation, .opacity, .ui_scaling {
|
||||
.other_controls_wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.other_controls_slider {
|
||||
margin-left: 18rem;
|
||||
}
|
||||
|
||||
.other_controls_slider_label {
|
||||
position: absolute;
|
||||
font-size: 1.6rem;
|
||||
width: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user