Skip to content

Strokes started on top of an inserted image do not draw (image overlay intercepts pen-down) #10

Description

@markm39

Problem

With a drawing tool active, starting a stroke on top of an inserted image does nothing — no ink is drawn. Starting the stroke outside the image and drawing across it works fine, and the ink renders over the image as expected.

Cause

src/components/editor/ImageInsertOverlay.tsx renders each image element inside a GestureDetector whose host Animated.View has pointerEvents="auto" unconditionally, with a tap gesture attached regardless of the active tool (drag/resize/rotate are gated on isSelected, but the tap-to-select gesture and the view's touch interception are not). When pen-down lands on the image, the overlay view claims the responder, so the ink canvas underneath never receives the touch and no stroke starts. A stroke that begins off the image works because the canvas owns the gesture before it crosses the overlay.

Expected behavior

While a drawing tool (pen/highlighter/marker/eraser) is active, pen input starting on an image should draw over it, exactly as if the stroke had started beside it. The image overlay should only intercept input when interception is meaningful:

  • Selection tool active: tap on image selects it (current behavior, keep).
  • Drawing tool active, image not selected: overlay must be transparent to pencil input (pointerEvents="none" or equivalent gating), letting the canvas start the stroke.
  • Drawing tool active, image currently selected: decide whether pen-down on the selected image should draw (deselect-and-draw) or keep manipulating; either is defensible, but it must be deliberate and consistent with text boxes.
  • Finger input should follow the finger-drawing toggle semantics: with finger drawing off, a finger tap on an image can still select/manipulate it even while a pen tool is active (this matches how finger pan coexists with pencil draw); with finger drawing on, fingers behave like the pencil. The existing handleFingerPointerDown hook on the host view is the natural place this discrimination already lives.

Notes

  • The same audit should cover the text box overlay: if text boxes intercept pen-down the same way, fix both in one pass so images and text behave identically under each tool.
  • Resize/rotate handles render only when selected, so gating the host view's interception by active tool + selection state should not affect manipulation of a selected element.
  • Regression checks: tap-to-select still works with the selection tool; drag/resize/rotate/crop of a selected image unaffected; eraser starting on an image erases strokes above it; stroke starting on an image near the page edge still respects overlay clipping.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions