Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Enhancements and Best Practices Implementation ✈ #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/devtool/jsx/controllers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export default function ControllerPanel({ deviceKey }) {
'.png'
}
className="control-icon"
decoding="async"
/>
<span className="control-label">{controlName}</span>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/devtool/jsx/hands.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function HandPanel({ deviceKey }) {
<img
src={`./assets/images/${strings.name}.png`}
className="control-icon"
decoding="async"
/>
<span className="control-label">{strings.displayName}</span>
</div>
Expand Down Expand Up @@ -82,7 +83,7 @@ export default function HandPanel({ deviceKey }) {
className="btn special-button"
onClick={onPressAnalog}
>
<img src="./assets/images/hand-pose.png" />
<img src="./assets/images/hand-pose.png" decoding="async" />
</button>
<input
ref={rangeRef}
Expand Down
3 changes: 2 additions & 1 deletion src/devtool/jsx/headset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default function HeadsetBar({ device }) {
<img
src="./assets/images/polyfill-on.png"
className="action-icon"
decoding="async"
/>
Polyfill
</button>
Expand Down Expand Up @@ -141,7 +142,7 @@ export default function HeadsetBar({ device }) {
(showDropDown ? ' button-pressed' : '')
}
onClick={() => {
setShowDropDown(!showDropDown);
setShowDropDown((prevShowDropDown) => !prevShowDropDown);
}}
>
<img
Expand Down
18 changes: 11 additions & 7 deletions src/devtool/jsx/inspector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import { EmulatorSettings } from '../js/emulatorStates';
import React from 'react';
import { changeRoomDimension } from '../js/messenger';


function fixNumber(rawValue) {
const value = Number(rawValue);
return (value >= 0 ? '\xa0' : '') + value.toFixed(2);
}

export default function Inspector({ device, inputMode }) {
const sceneContainerRef = React.useRef();
const meshWidthRef = React.useRef();
Expand All @@ -35,10 +41,6 @@ export default function Inspector({ device, inputMode }) {
});
});

function fixNumber(rawValue) {
const value = Number(rawValue);
return (value >= 0 ? '\xa0' : '') + value.toFixed(2);
}

React.useEffect(() => {
sceneContainerRef.current.appendChild(device.canvas);
Expand All @@ -58,7 +60,7 @@ export default function Inspector({ device, inputMode }) {
<div id="transform-component">
<button
onClick={() => {
setShowTransforms(!showTransforms);
setShowTransforms((prevShowTransforms) => !prevShowTransforms);
setShowRoomSettings(false);
setShowMeshSettings(false);
}}
Expand All @@ -68,7 +70,7 @@ export default function Inspector({ device, inputMode }) {
</button>
<button
onClick={() => {
setShowRoomSettings(!showRoomSettings);
setShowRoomSettings((prevShowRoomSettings) => !prevShowRoomSettings);
setShowTransforms(false);
setShowMeshSettings(false);
}}
Expand All @@ -78,7 +80,7 @@ export default function Inspector({ device, inputMode }) {
</button>
<button
onClick={() => {
setShowMeshSettings(!showMeshSettings);
setShowMeshSettings((prevShowMeshSettings) => !prevShowMeshSettings);
setShowRoomSettings(false);
setShowTransforms(false);
}}
Expand All @@ -101,6 +103,7 @@ export default function Inspector({ device, inputMode }) {
: CONTROLLER_STRINGS[deviceKey].name
}.png`}
className="control-icon"
decoding="async"
/>
</div>
<div className="col-10 transform-body">
Expand Down Expand Up @@ -144,6 +147,7 @@ export default function Inspector({ device, inputMode }) {
<img
src="./assets/images/roomscale.png"
className="control-icon"
decoding="async"
/>
</div>
<div className="col-10 transform-body">
Expand Down