Open
Conversation
This commit introduces a new circle drawing tool to Asciiflow. The circle tool allows you to draw circles by clicking for the center point and dragging to define the radius. The circle is rendered using specific ASCII characters for its different segments: - '-' for top and bottom sides - '|' for left and right sides - '/' for top-left and bottom-right diagonals - '\' for top-right and bottom-left diagonals Key changes include: - A new `DrawCircle` class in `client/draw/circle.ts` implementing the drawing logic. - Addition of `ToolMode.CIRCLE` to the `ToolMode` enum. - Registration of the new tool in the application's store. - Integration of the circle tool into the UI drawer, including an icon, tool selection button, and help text. - Implementation of an `alt + 7` keyboard shortcut to activate the circle tool.
This commit incorporates your feedback to improve the circle drawing tool:
1. **Aspect Ratio Compensation**: The circle drawing logic now accounts for the non-square aspect ratio of characters (approx. 2:1 height:width). This is achieved by drawing an ellipse in the character grid that appears visually as a round circle.
2. **Line Thickness and Connectivity**: The algorithm for selecting cells to draw on has been tuned to prioritize visual connectivity while aiming for a line that is predominantly one character thick. A tolerance factor of 0.75 is used in distance calculations.
3. **Character Selection by Angular Sectors**: Character selection ('|', '-', '/', '\') is now based on 8 precise angular sectors around the circle, as specified, ensuring more accurate visual representation. Angles are calculated using aspect-ratio-compensated coordinates.
4. **Toolbar Adjustments**:
- The "Circles" tool button in the toolbar has been moved to appear directly below the "Boxes" tool.
- The tool name has been updated from "Circle" to "Circles" for consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a basic implementation of a circle tool:
