Infinite-Chess / infinitechess.org

Infinite Chess Web Server
https://www.infinitechess.org
GNU Affero General Public License v3.0
173 stars 39 forks source link

Add square highlights and arrow drawing on the chessboard #149

Open tsevasa opened 1 month ago

tsevasa commented 1 month ago

Right-clicking on a square should highlight it, while dragging right-click should draw an arrow from the destination to the end, like on chess.com.

Naviary2 commented 1 month ago

Yes! My thoughts are there would be 2 modes for the right-click drag action. The first mode as you described above will draw arrows. The 2nd mode will draw "rays". Those are basically infinite lines of highlighted squares, which would be very useful for analyzing positions and diagonals!

Naviary2 commented 1 month ago

I had another idea, what if by default the mode for right-click drag was to draw arrows, but double-right-click-drag drew rays? That would avoid having us to add a UI button for toggling your mode!

And on top of that, what if triple-right-click just auto-drew rays coming out of all directions centered on the square! Maybe not the most useful.. but I imagine lining up hippogonals with knightriders would be so much easier if on demand you could highlight all lines that you can check a piece on.

BF5258 commented 1 month ago

Chess.com stores highlighted squares separately for each move, allowing the move history to be annotated. This could be useful for analyzing games, but personally, I've never used it.

Should past highlights be stored or only present?

https://github.com/user-attachments/assets/529fae1e-02d2-4399-8a53-0d3cf4eecadf

Naviary2 commented 1 month ago

Should past highlights be stored or only present?

That's a good question... My thoughts are lining up attacks may take several moves, so deleting them every move may be troublesome. Highlighting squares in Infinite Chess serves more to help you line up attacks, vs in classical chess, highlights more-so helps when speaking/streaming to an audience?

BF5258 commented 1 month ago

If the user tries to highlight a square with a second color, should it mix or be overridden?

The colors might need adjusting though. The blue + yellow doesn't look so great.

Naviary2 commented 1 month ago

If the user tries to highlight a square with a second color, should it mix or be overridden?

I think multiple highlight lines intersecting should mix, because it will emphasize the intersection squares! I'm all for having toggle-able colors on say local, or an analysis mode, since it could be quite creative to make art with this! :art: Let's make it compatible with multiple colors. For online mode though we should probably stick with 1 color, determined by the theme.