+Added AlwaysUpText component that rotates text by 180 degrees if it is upside down (taking view rotation into account) +Added SimpleLabelText component that always displays text horizontally relative to the view rotation +Added mapRotationService which stores a subscribable view rotation value *Refactored all ObjectRenderers to use the above components for object labels
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
import { ReactSVG } from 'react-svg'
|
|
import AlwaysUpText from '../text/AlwaysUpText';
|
|
|
|
export default function SpawnPointRenderer(props) {
|
|
const { object } = props;
|
|
const [x, y] = object.pos.toSVGCoords();
|
|
|
|
return (
|
|
<g className="spawn-point" transform={`translate(${x}, ${y}) rotate(${object.rot.y})`}>
|
|
<g className="signal-icon" transform={`rotate(180) translate(-2.835, -2.835)`}>
|
|
<ReactSVG
|
|
src={`${process.env.PUBLIC_URL}/assets/spawn.svg`}
|
|
wrapper='svg'
|
|
|
|
beforeInjection={(svg) => {
|
|
svg.setAttribute('width', '1.5mm');
|
|
svg.setAttribute('height', '1.5mm');
|
|
}}
|
|
/>
|
|
</g>
|
|
<AlwaysUpText
|
|
baseRot={object.rot.y}
|
|
additionalRot={-90}
|
|
offsetY={3}
|
|
reverseAnchor={true}
|
|
text={object.getPrintableSpawnPointName()}
|
|
/>
|
|
</g>
|
|
);
|
|
}
|