Skip to content

Commit 4a0d21b

Browse files
tobifalkcassava
authored andcommitted
ui: Refactor rendering settings
1 parent 43af6a6 commit 4a0d21b

File tree

2 files changed

+52
-43
lines changed

2 files changed

+52
-43
lines changed

ui/src/components/rendering.jsx

+40-43
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Rendering extends Component {
129129
<div className="m-2" style={{ position: "absolute", textAlign: "left" }}>
130130
<SettingFilled
131131
className={`mb-2 ${optionsVisible ? "icon" : "icon-deactive"}`}
132-
style={{ fontSize: "22px" }}
132+
style={{ fontSize: "16px" }}
133133
onClick={() => this.toggleOptions()}
134134
/>
135135

@@ -142,64 +142,61 @@ class Rendering extends Component {
142142
<small className="mr-2 ml-2 mb-1">{currentPerspective}</small>
143143
</div>
144144
</React.Fragment>
145-
146-
<React.Fragment>
147-
<p className="m-0 mt-2 text-light">
148-
<span>3D Frustum</span>
149-
</p>
150-
<ToggleSwitch
151-
onChange={() => this.setState({ frustum3d: !frustum3d })}
152-
checked={frustum3d}
153-
/>
154-
</React.Fragment>
155-
<React.Fragment>
156-
<p className="m-0 mt-2 text-light">
157-
<span>Axes</span>
158-
</p>
159-
<ToggleSwitch
160-
onChange={() => this.toggleHelperAxes()}
161-
checked={helperAxesVisible}
162-
/>
163-
</React.Fragment>
164-
<React.Fragment>
165-
<p className="m-0 mt-2 text-light">
166-
<span>Grid</span>
167-
</p>
168-
<ToggleSwitch onChange={() => this.toggleGrid()} checked={gridVisible} />
169-
</React.Fragment>
145+
{this.renderToggleSwitch(
146+
"3D Frustum",
147+
() => this.setState({ frustum3d: !frustum3d }),
148+
frustum3d
149+
)}
150+
{this.renderToggleSwitch("Axes", () => this.toggleHelperAxes(), helperAxesVisible)}
151+
{this.renderToggleSwitch("Grid", () => this.toggleGrid(), gridVisible)}
170152
<div className={gridVisible ? "" : "d-none"}>
171153
<p className="m-0 mt-2 text-light">
172154
<span>
173-
Cellsize:
155+
Grid Cellsize:
174156
{` ${gridCellsize}m`}
175157
</span>
176158
</p>
177-
<Slider
178-
tooltip={false}
179-
value={gridCellsize}
180-
onChange={this.handleGridCellsize}
181-
min={0}
182-
max={25}
183-
step={0.5}
184-
/>
159+
<div className="rangeslider-horizontal-thin">
160+
<Slider
161+
tooltip={false}
162+
value={gridCellsize}
163+
onChange={this.handleGridCellsize}
164+
min={0}
165+
max={25}
166+
step={0.5}
167+
/>
168+
</div>
185169
</div>
186-
<React.Fragment>
187-
<p className="m-0 mt-2 text-light">Reset</p>
188-
<UndoOutlined
189-
className="m-2 icon-white"
190-
style={{ fontSize: "22px" }}
191-
onClick={() => this.resetRenderOptions()}
192-
/>
193-
</React.Fragment>
194170
</div>
195171
</div>
172+
<div
173+
className="m-0 mt-2 text-light"
174+
style={{ position: "absolute", transform: "translate(25px, -0.5px)" }}
175+
>
176+
<UndoOutlined
177+
className="m-2 icon-white"
178+
style={{ color: "#2bbbad", fontSize: "16px" }}
179+
onClick={() => this.resetRenderOptions()}
180+
/>
181+
</div>
196182
</div>
197183
{this.renderSensorSelect(this.sensorType.Object, selectObjSensors)}
198184
{this.renderSensorSelect(this.sensorType.Lane, selectLaneSensors)}
199185
</Card>
200186
);
201187
}
202188

189+
renderToggleSwitch = (label, action, isChecked) => {
190+
return (
191+
<React.Fragment>
192+
<p className="m-0 mt-2 text-light" style={{ fontSize: "16px" }}>
193+
<span>{label}</span>
194+
</p>
195+
<ToggleSwitch onChange={action} checked={isChecked} height={10} />
196+
</React.Fragment>
197+
);
198+
};
199+
203200
renderSensorSelect = (sensorType, selectSensors) => {
204201
let colors;
205202
let defaultColors;

ui/src/css/rangeslider.scss

+12
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,15 @@
5454
-ms-touch-action: none;
5555
touch-action: none;
5656
}
57+
58+
.rangeslider-horizontal-thin .rangeslider-horizontal{
59+
height: 10px;
60+
border: 0px solid #ccc;
61+
margin-top: 8px;
62+
}
63+
64+
.rangeslider-horizontal-thin .rangeslider__handle {
65+
width: 22px;
66+
height: 22px;
67+
border-radius: 22px;
68+
}

0 commit comments

Comments
 (0)