Add labelScale prop for dynamic text scaling in MapNode and adjust RegionMap to utilize it based on compact view
This commit is contained in:
@@ -21,6 +21,7 @@ interface MapNodeProps {
|
||||
showJumps?: boolean;
|
||||
showKills?: boolean;
|
||||
viewBoxWidth?: number; // Add viewBox width for scaling calculations
|
||||
labelScale?: number;
|
||||
}
|
||||
|
||||
export const MapNode: React.FC<MapNodeProps> = ({
|
||||
@@ -43,6 +44,7 @@ export const MapNode: React.FC<MapNodeProps> = ({
|
||||
showJumps = false,
|
||||
showKills = false,
|
||||
viewBoxWidth = 1200,
|
||||
labelScale = 1,
|
||||
}) => {
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
@@ -201,8 +203,7 @@ export const MapNode: React.FC<MapNodeProps> = ({
|
||||
textShadow: '2px 2px 4px rgba(0,0,0,0.8)',
|
||||
vectorEffect: 'non-scaling-stroke'
|
||||
}}
|
||||
transform={`scale(${1 / (1200 / viewBoxWidth)})`}
|
||||
transformOrigin="0 0"
|
||||
transform={`scale(${(1 / (1200 / viewBoxWidth)) * labelScale})`}
|
||||
>
|
||||
{name} {security !== undefined && (
|
||||
<tspan fill={getSecurityColor(security)}>{security.toFixed(1)}</tspan>
|
||||
@@ -229,8 +230,7 @@ export const MapNode: React.FC<MapNodeProps> = ({
|
||||
textShadow: '1px 1px 2px rgba(0,0,0,0.8)',
|
||||
vectorEffect: 'non-scaling-stroke'
|
||||
}}
|
||||
transform={`scale(${1 / (1200 / viewBoxWidth)})`}
|
||||
transformOrigin="0 0"
|
||||
transform={`scale(${(1 / (1200 / viewBoxWidth)) * labelScale})`}
|
||||
>
|
||||
📡 {signatures}
|
||||
</text>
|
||||
@@ -253,8 +253,7 @@ export const MapNode: React.FC<MapNodeProps> = ({
|
||||
textShadow: '1px 1px 2px rgba(0,0,0,0.8)',
|
||||
vectorEffect: 'non-scaling-stroke'
|
||||
}}
|
||||
transform={`scale(${1 / (1200 / viewBoxWidth)})`}
|
||||
transformOrigin="0 0"
|
||||
transform={`scale(${(1 / (1200 / viewBoxWidth)) * labelScale})`}
|
||||
>
|
||||
🚀 {jumps}
|
||||
</text>
|
||||
@@ -277,8 +276,7 @@ export const MapNode: React.FC<MapNodeProps> = ({
|
||||
textShadow: '1px 1px 2px rgba(0,0,0,0.8)',
|
||||
vectorEffect: 'non-scaling-stroke'
|
||||
}}
|
||||
transform={`scale(${1 / (1200 / viewBoxWidth)})`}
|
||||
transformOrigin="0 0"
|
||||
transform={`scale(${(1 / (1200 / viewBoxWidth)) * labelScale})`}
|
||||
>
|
||||
⚔️ {kills}
|
||||
</text>
|
||||
|
@@ -1114,6 +1114,7 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
||||
showJumps={showJumps}
|
||||
showKills={showKills}
|
||||
viewBoxWidth={viewBox.width}
|
||||
labelScale={isCompact ? 2.0 : 1}
|
||||
/>
|
||||
))}
|
||||
|
||||
|
Reference in New Issue
Block a user