nextcloud-libraries / nextcloud-libraries/nextcloud-image-editor

Watch whether the 24px grab band around strokes gets in the way of placing annotations

Open
#58 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

AI assisted status: triage type: enhancement
Dominant language
TypeScript
Stars
2
Forks
0
Avg merge
1h 46m
Merged PRs (30d)
58

Description

MIN_HIT_AREA in lib/editor/render.ts:248 gives every stroked annotation an invisible 24px grab band, so a one pixel line can be selected without hitting that one pixel. It came from #50, where the complaint was the opposite one: selecting a thin line meant zooming in until it was wide enough to click.

Since #53 a click on an existing annotation selects it whatever tool is held, so that band now decides two things rather than one. Placing a caption or a sticker within 24 screen pixels of an existing stroke selects the stroke instead of placing anything. The gesture still draws, because a drag over an annotation draws (DRAG_THRESHOLD, lib/editor/tools.ts:58), but click-created annotations have no drag to fall back on.

Nobody has reported it. This is a note to watch for it, with the numbers written down while they are fresh:

  • 24px is the grab band, in screen pixels at any zoom (hitAreaWidth() divides by the view scale)
  • 4px is what separates a click from a drag
  • the band applies to strokes only, so an unfilled rectangle is still selected by its outline rather than by the space it encloses

If it does bite, the first thing to try is a smaller band, 12 to 16px, which still beats the one or two pixels a hairline had before #50. The e2e in annotations.spec.ts ("a thin line can be selected without hitting it exactly") clicks 8px off the line, so it would have to move with the constant, and that is the test to watch when changing it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read MIN_HIT_AREA in lib/editor/render.ts:248 and DRAG_THRESHOLD in lib/editor/tools.ts:58, then inspect the related interaction flow. Run the e2e in annotations.spec.ts, especially "a thin line can be selected without hitting it exactly," and check whether placing a caption or sticker near a stroke is intercepted. Done means the intended selection behavior and click-created annotation placement are both covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.