Skip to content

Commit

Permalink
Fix the display of labels on buildings.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: c5d23eb5d7f8d93116b466206949daa4cf9b6d1d
  • Loading branch information
cpojer committed May 31, 2024
1 parent 9d400bc commit 15dd314
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
26 changes: 14 additions & 12 deletions hera/Building.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,20 @@ const BuildingTile = memo(function BuildingTile({
return building.label != null ? (
<>
{buildingTile}
<div
className={cx(baseStyle, absolute && absoluteStyle)}
style={{
[vars.set('x')]: `${positionX}px`,
[vars.set('y')]: `${positionY}px`,
height,
width: `${size}px`,
zIndex: zIndex ?? 0,
}}
>
<Label entity={building} hide={!!animation} />
</div>
{building.label !== null && (
<div
className={cx(baseStyle, absoluteStyle)}
style={{
[vars.set('x')]: `${positionX}px`,
[vars.set('y')]: `${positionY}px`,
height,
width: `${size}px`,
zIndex: zIndex ?? 0,
}}
>
<Label entity={building} hide={!!animation} />
</div>
)}
</>
) : (
buildingTile
Expand Down
7 changes: 6 additions & 1 deletion hera/ui/MapInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,14 @@ const unitStyle = css`
`;

const buildingStyle = css`
> div:nth-child(1) {
> div:nth-child(1),
> div:nth-child(2) {
margin-top: -${TileSize - 3}px;
}
> div:nth-child(2) {
zoom: 1.5;
}
`;

const mapStyle = css`
Expand Down

0 comments on commit 15dd314

Please sign in to comment.