Fix map display and zoom issues

-   Reduced region label size.
-   Restored connections.
-   Inverted zoom direction.
This commit is contained in:
gpt-engineer-app[bot]
2025-06-14 00:50:43 +00:00
parent ce53ca5977
commit dd1fe9532d
3 changed files with 12 additions and 12 deletions

View File

@@ -103,8 +103,8 @@ export const GalaxyMap = () => {
const mouseX = e.clientX - rect.left; const mouseX = e.clientX - rect.left;
const mouseY = e.clientY - rect.top; const mouseY = e.clientY - rect.top;
// Reverse scroll direction: positive deltaY zooms out, negative zooms in // Invert scroll direction: negative deltaY (scroll up) zooms out, positive (scroll down) zooms in
const scale = e.deltaY > 0 ? 1.1 : 0.9; const scale = e.deltaY < 0 ? 1.1 : 0.9;
const newWidth = viewBox.width * scale; const newWidth = viewBox.width * scale;
const newHeight = viewBox.height * scale; const newHeight = viewBox.height * scale;

View File

@@ -27,9 +27,9 @@ export const MapNode: React.FC<MapNodeProps> = ({
: '#a855f7'; // fallback purple color : '#a855f7'; // fallback purple color
if (type === 'region') { if (type === 'region') {
// Reduce region size to prevent overlap // Further reduce region size to prevent overlap - made even smaller
const pillWidth = Math.max(name.length * 8, 60); // Reduced from 12 to 8, min from 80 to 60 const pillWidth = Math.max(name.length * 5, 40); // Reduced from 8 to 5, min from 60 to 40
const pillHeight = 24; // Reduced from 32 to 24 const pillHeight = 18; // Reduced from 24 to 18
return ( return (
<g <g
@@ -71,13 +71,13 @@ export const MapNode: React.FC<MapNodeProps> = ({
}`} }`}
/> />
{/* Text inside pill */} {/* Text inside pill - made smaller */}
<text <text
x="0" x="0"
y="4" y="3"
textAnchor="middle" textAnchor="middle"
fill="#ffffff" fill="#ffffff"
fontSize="11" fontSize="8"
fontWeight="bold" fontWeight="bold"
className="transition-all duration-300 pointer-events-none select-none" className="transition-all duration-300 pointer-events-none select-none"
style={{ textShadow: '1px 1px 2px rgba(0,0,0,0.8)' }} style={{ textShadow: '1px 1px 2px rgba(0,0,0,0.8)' }}
@@ -89,7 +89,7 @@ export const MapNode: React.FC<MapNodeProps> = ({
} else { } else {
// Render system as a dot with external label // Render system as a dot with external label
const nodeSize = 6; const nodeSize = 6;
const textOffset = 18; // Position text below the dot const textOffset = 20; // Position text below the dot - moved down more
return ( return (
<g <g

View File

@@ -104,8 +104,8 @@ export const RegionMap: React.FC<{ regionName: string }> = ({ regionName }) => {
const mouseX = e.clientX - rect.left; const mouseX = e.clientX - rect.left;
const mouseY = e.clientY - rect.top; const mouseY = e.clientY - rect.top;
// Reverse scroll direction: positive deltaY zooms out, negative zooms in // Invert scroll direction: negative deltaY (scroll up) zooms out, positive (scroll down) zooms in
const scale = e.deltaY > 0 ? 1.1 : 0.9; const scale = e.deltaY < 0 ? 1.1 : 0.9;
const newWidth = viewBox.width * scale; const newWidth = viewBox.width * scale;
const newHeight = viewBox.height * scale; const newHeight = viewBox.height * scale;
@@ -113,7 +113,7 @@ export const RegionMap: React.FC<{ regionName: string }> = ({ regionName }) => {
const mouseYInSVG = viewBox.y + (mouseY / rect.height) * viewBox.height; const mouseYInSVG = viewBox.y + (mouseY / rect.height) * viewBox.height;
const newX = mouseXInSVG - (mouseX / rect.width) * newWidth; const newX = mouseXInSVG - (mouseX / rect.width) * newWidth;
const newY = mouseYInSVG - (mouseY / rect.height) * newWidth; const newY = mouseYInSVG - (mouseY / rect.height) * newHeight;
setViewBox({ setViewBox({
x: newX, x: newX,