这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

The grid lacked visual markers for the X and Y axes at world coordinates (0,0), making it difficult to identify the origin point when navigating the infinite grid.

Changes

  • Added darker (#333, 2px) axis lines overlaying the grid at X=0 and Y=0 world coordinates
  • Axis positions automatically adjust with panning and zooming by calculating grid indices from offsetX, offsetY, and calculatedGridSize
  • Draw axes after cells to ensure they render on top of the regular grid lines

Implementation (CanvasGrid.tsx):

// Calculate grid indices for world coordinates (0, 0)
const xAxisGridIndex = calculatedGridSize / 2 - offsetX;
const yAxisGridIndex = calculatedGridSize / 2 - 1 - offsetY;

ctx.strokeStyle = '#333';
ctx.lineWidth = 2;

// Draw Y-axis (vertical line at X=0)
if (xAxisGridIndex >= 0 && xAxisGridIndex < calculatedGridSize) {
  const xPos = getCoordinate(xAxisGridIndex, cellSize);
  ctx.beginPath();
  ctx.moveTo(xPos, 0);
  ctx.lineTo(xPos, canvasHeight);
  ctx.stroke();
}

// Draw X-axis (horizontal line at Y=0)
if (yAxisGridIndex >= 0 && yAxisGridIndex < calculatedGridSize) {
  const yPos = getCoordinate(yAxisGridIndex, cellSize);
  ctx.beginPath();
  ctx.moveTo(0, yPos);
  ctx.lineTo(canvasWidth, yPos);
  ctx.stroke();
}

Screenshots

Default view:
Default view with axis lines

After panning:
Axes shift with panning

After zooming:
Axes scale with zoom

Original prompt

This section details on the original issue you should resolve

<issue_title>X, Y axis at 0,0 should be darker line</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 4, 2025 05:54
Co-authored-by: wintermuted <2337325+wintermuted@users.noreply.github.com>
Co-authored-by: wintermuted <2337325+wintermuted@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix X, Y axis color at the origin to be darker Add darker axis lines at X=0, Y=0 origin Nov 4, 2025
Copilot AI requested a review from wintermuted November 4, 2025 05:58
Copilot finished work on behalf of wintermuted November 4, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

X, Y axis at 0,0 should be darker line

2 participants