fix: make drawButton's clickable region match the box it draws - #37
Merged
Conversation
The hit test used strict inequalities on both axes while pygame.draw.rect fills a half-open range, so the painted left and top edge lines of every button were dead while the right and bottom ones worked. Comparing half-open on both axes makes the clickable region exactly the drawn one, and keeps edge-to-edge buttons from both claiming a shared boundary coordinate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Self-review rubric (scored against the diff and command output, not judgment):
Observations folded in rather than left inline:
One issue was found and fixed during this review; the remaining items are recorded above rather than blocking. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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.
Summary
drawButton's hit test compared strictly on both axes (xpos + width > mouse[0] > xpos), whilepygame.draw.rectfills the half-open range[xpos, xpos + width). The painted left and top edge lines of every button were therefore not clickable, though the right and bottom ones were. The comparison is now half-open on both axes, so the clickable region is exactly the region the box is drawn over.colorBox, so the two cannot drift apart.drawButtondocstring and the README'sdrawButtonentry now state the clickable region explicitly.Compatibility
No public signature is changed, and the documented repeat-fire semantics are untouched. The change is a one-pixel widening of the hit area on two edges so that it coincides with the already-drawn box; no vendored consumer copy (Roam, Apex, Ophidian, Patchwork, Tic-Tak-Toe) can plausibly depend on a dead strip over painted pixels. A cross-org code search for
drawButtoncall sites was attempted but is not available to this session, so the assessment above rests on the nature of the change rather than on enumerated call sites.Test plan
python3 -m py_compile src/main/python/preponderous/graphik/graphik.py— succeedspython3 -m pytest— 37 passed (was 26)test_draw_button_clickable_region_matches_the_drawn_box[left_edge],[top_edge],[top_left_corner]andtest_adjacent_buttons_do_not_share_a_clickable_boundaryall FAIL; with it restored, all PASS.conftest.pydummy SDL drivers; no display or audio device is required.Deferred work
Issue #34 (release tags pushed without the
vprefixpublish.ymlrequires) was the only other open issue at triage time and was not picked up this cycle. Its own body defers it pending a maintainer decision between two release-process directions, and it touches.github/workflows/and the release process, both of which are excluded from autonomous change.Closes #36
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson