Skip to content

Suggestion for "Hit Testing | renderobjects.com" #2

Description

@loic-sharma

Page: https://renderobjects.com/guides/hit-testing/#the-hittest-method

Selected text is bolded below, with the surrounding paragraph(s) for context:

The hitTest Method#

Potential suggestion: A common mistake beginners make is to assume that RenderBox.hitTest returns true if the position is in the current render object. However, that is incorrect. Instead, RenderBox.hitTest returns whether hit testing was concluded by this render object or one of its children. In other words, a render object that is hit should return false if it wants hit testing to continue.

I'd consider adding a quick explanation on this behavior since this is common misunderstanding. In hindsight, perhaps we should've made hitTest return an enum to make this behavior much more obvious (eg HitTestStatus.absorbed, HitTestStatus.continue)

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