refactor(web/radial): move center icon into absolute div

fixes annoying issues when trying to rotate the icon
This commit is contained in:
Luke
2023-02-11 13:49:10 +01:00
parent 71885f5831
commit d0ffed8592

View File

@@ -44,9 +44,15 @@ const useStyles = createStyles((theme) => ({
cursor: 'pointer', cursor: 'pointer',
}, },
}, },
centerIconContainer: {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
pointerEvents: 'none',
},
centerIcon: { centerIcon: {
color: '#fff', color: '#fff',
pointerEvents: 'none',
}, },
})); }));
@@ -120,7 +126,6 @@ const RadialMenu: React.FC = () => {
</> </>
); );
})} })}
{/* TODO: rotate go back icon */}
<g <g
transform={`translate(175, 175)`} transform={`translate(175, 175)`}
onClick={() => { onClick={() => {
@@ -133,16 +138,16 @@ const RadialMenu: React.FC = () => {
> >
<circle r={30} className={classes.centerCircle} /> <circle r={30} className={classes.centerCircle} />
</g> </g>
</svg>
<div className={classes.centerIconContainer}>
<FontAwesomeIcon <FontAwesomeIcon
icon={!menu.sub ? 'xmark' : 'arrow-rotate-left'} icon={!menu.sub ? 'xmark' : 'arrow-rotate-left'}
fixedWidth
className={classes.centerIcon} className={classes.centerIcon}
color="#fff" color="#fff"
width={28} size="2x"
height={28}
x={175 - 28 / 2}
y={175 - 28 / 2}
/> />
</svg> </div>
</ScaleFade> </ScaleFade>
</Box> </Box>
</> </>