diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5fd66..5d9de02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Prevent triple-click select from selecting the list item (e.g checkbox, bullet) * Use DejaVu Sans font for regular text instead of heavier Noto - might help with the freeze issues. * Change History icon (again) + * Make it easier to check on or off the checkbox by adding some buffer (instead of having to precisely click inside it) # 0.5.2 diff --git a/bouquin/markdown_editor.py b/bouquin/markdown_editor.py index 6f45c22..b9a8aff 100644 --- a/bouquin/markdown_editor.py +++ b/bouquin/markdown_editor.py @@ -960,7 +960,15 @@ class MarkdownEditor(QTextEdit): doc_pos = block.position() + i r = char_rect_at(doc_pos, icon) - if r.contains(pt): + # ---------- Relax the hit area here ---------- + # Expand the clickable area horizontally so you don't have to + # land exactly on the glyph. This makes the "checkbox zone" + # roughly 3× the glyph width, centered on it. + pad = r.width() # one glyph width on each side + hit_rect = r.adjusted(-pad, 0, pad, 0) + # --------------------------------------------- + + if hit_rect.contains(pt): # Build the replacement: swap ☐ <-> ☑ (keep trailing space) new_icon = ( self._CHECK_CHECKED_DISPLAY