Skip to content

Feature: make round move path with cursor's colour.#47

Merged
kimgh06 merged 3 commits into
mainfrom
feature/arrow
Sep 17, 2025
Merged

Feature: make round move path with cursor's colour.#47
kimgh06 merged 3 commits into
mainfrom
feature/arrow

Conversation

@kimgh06

@kimgh06 kimgh06 commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

No description provided.

…dering and asset loading

- Simplified cursor movement path drawing logic by consolidating path scaling and rendering steps.
- Enhanced asset loading process with improved font loading handling and vector asset caching.
- Streamlined rendering logic for interaction objects to ensure better performance and clarity.
Copilot AI review requested due to automatic review settings September 17, 2025 13:27
@kimgh06 kimgh06 merged commit 9393164 into main Sep 17, 2025
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the path rendering system to use the cursor's color for movement paths and improves the visual appearance with rounded corners. The change involves renaming the path assets file and implementing sophisticated path drawing with smooth rounded corners.

  • Renamed asset file from paths.json to renderPaths.json for better naming consistency
  • Enhanced path rendering with cursor color integration and rounded corner visualization
  • Improved code style and structure in path drawing logic

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/components/tilemap/index.tsx Updates import to use renamed renderPaths.json asset file
src/components/canvas/index.tsx Implements cursor-colored path rendering with rounded corners and improved drawing logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +254 to 265
if (!(reviveAt > 0 && Date.now() < reviveAt && cachedVectorAssets?.stun)) return;
const stunScale = (zoom / 2) * scale;
ctx.save();
ctx.translate(x - tileSize / 2 / scale, y - tileSize / 2 / scale);
ctx.fillStyle = 'white';
ctx.strokeStyle = 'black';
ctx.scale(stunScale, stunScale);
cachedVectorAssets.stun.forEach(stunPath => {
ctx.fill(stunPath);
ctx.stroke(stunPath);
});
ctx.restore();

Copilot AI Sep 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The negated condition with early return makes the logic harder to follow. Consider using the original positive condition with proper block structure for better readability.

Copilot uses AI. Check for mistakes.
Comment on lines +436 to +440
const scaledPoints = paths?.map(vec => {
const [vX, vY] = [vec.x + compensation.x, vec.y + compensation.y];
return { x: vX * tileSize, y: vY * tileSize };
});
if (scaledPoints.length <= 1) return;

Copilot AI Sep 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early return should check for empty paths before the expensive mapping operation. Move this check before line 436 to avoid unnecessary computation when paths is empty.

Suggested change
const scaledPoints = paths?.map(vec => {
const [vX, vY] = [vec.x + compensation.x, vec.y + compensation.y];
return { x: vX * tileSize, y: vY * tileSize };
});
if (scaledPoints.length <= 1) return;
if (!paths || paths.length <= 1) return;
const scaledPoints = paths.map(vec => {
const [vX, vY] = [vec.x + compensation.x, vec.y + compensation.y];
return { x: vX * tileSize, y: vY * tileSize };
});

Copilot uses AI. Check for mistakes.
@kimgh06 kimgh06 deleted the feature/arrow branch December 23, 2025 12:11
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.

2 participants