Skip to content

feat: add arrow start offset option for improved arrow positioning#225

Open
DevArches wants to merge 3 commits intoClariity:mainfrom
DevArches:feat/arrowOffset
Open

feat: add arrow start offset option for improved arrow positioning#225
DevArches wants to merge 3 commits intoClariity:mainfrom
DevArches:feat/arrowOffset

Conversation

@DevArches
Copy link
Contributor

@DevArches DevArches commented Feb 2, 2026

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Adds a new arrowStartOffset property to arrowOptions that controls how far from the center of the starting square an arrow begins, as a fraction of the square width. This allows developers to offset arrow origins toward the edge of the square for a cleaner look (similar to chess.com), where arrows emerge from the base of a piece rather than its center.

  • 0 = arrow starts from the center of the square (default, preserves existing behavior)
  • 0.3–0.4 = arrow starts near the edge of the square, giving a chess.com-like appearance
  • 0.5 = arrow starts at the square boundary

Based on this issue #222

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Verified visually in Storybook ArrowOptions story with the new Start Offset slider across straight, diagonal, and knight move arrows
  • Confirmed default value of 0 preserves existing arrow behavior
  • pnpm test:static passes (tsc, eslint, prettier)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if appropriate):

Before:
image

After:
image

Additional context

Add any other context about the pull request here.

- Introduced a new `arrowStartOffset` property to control the starting position of arrows relative to the square's center.
- Updated the ArrowOptions story to include a range input for adjusting the start offset.
- Modified arrow rendering logic to account for the new start offset, enhancing visual accuracy.
@vercel
Copy link

vercel bot commented Feb 2, 2026

@DevArches is attempting to deploy a commit to the Ryan Gregory's projects Team on Vercel.

A member of the Team first needs to authorize it.

@DevArches
Copy link
Contributor Author

Should be ready now. Just wanted to update some variable names and comments and then forgot to use prettier to format. This could be a nice improvement for my project that has some learning features like showing all possible moves a piece has. And since sometimes that can be in all directions, thats a lot of arrows covering up a piece.

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.

1 participant