Skip to content

Commit

Permalink
fix(isis): do not adjust opacity of bg elements (#7103)
Browse files Browse the repository at this point in the history
  • Loading branch information
2hwk authored and aguther committed Apr 26, 2022
1 parent f406f6d commit 5827537
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 13 additions & 10 deletions src/instruments/src/ISIS/AutoBrightness.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const AutoBrightness: React.FC<AutoBrightnessProps> = ({ bugsActive, chil

const [targetBrightness, setTargetBrightness] = useState(isDaytimeRef.current ? dayBrightness : nightBrightness);
const [currentBrightness, setCurrentBrightness] = useSimVar('L:A32NX_BARO_BRIGHTNESS', 'number', 10000);
const [homeCockpit] = useSimVar('L:A32NX_HOME_COCKPIT_ENABLED', 'bool', 200);

const isBrightnessUpPressed = useRef(false);
const isBrightnessDownPressed = useRef(false);
Expand Down Expand Up @@ -89,16 +88,20 @@ export const AutoBrightness: React.FC<AutoBrightnessProps> = ({ bugsActive, chil
{ additionalDeps: [currentBrightness, targetBrightness], runOnStart: false },
);

if (homeCockpit) {
return (
<g style={{ opacity: 1.0 }}>
{children}
</g>
);
}

return (
<g style={{ opacity: currentBrightness }}>
<g>
<svg
style={{
position: 'absolute',
top: '0%',
left: '0%',
width: '100%',
height: '100%',
backgroundColor: `rgba(0,0,0, ${1 - currentBrightness})`,
zIndex: 3,
}}
viewBox="0 0 512 512"
/>
{children}
</g>
);
Expand Down
2 changes: 1 addition & 1 deletion src/instruments/src/ISIS/ISISDisplayUnit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const ISISDisplayUnit: React.FC<ISISDisplayUnitProps> = ({ indicatedAirsp
if (state === DisplayUnitState.Selftest) {
return (
<>
<svg id="SelfTest" className="SelfTest" version="1.1" viewBox="0 0 512 512">
<svg id="SelfTest" style={{ backgroundColor: 'black' }} className="SelfTest" version="1.1" viewBox="0 0 512 512">
<g id="AttFlag">
<rect id="AttTest" className="FillYellow" width="84" height="40" x="214" y="174" />
<text id="AltTestTxt" className="TextBackground" textAnchor="middle" x="256" y="206">ATT</text>
Expand Down

0 comments on commit 5827537

Please sign in to comment.