You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The existing p5.Shape system provides a way to create and render custom shapes using primitives such as vertices, curves, ellipses and rectangles.
A possible next step is to extend this infrastructure so that Shapes can also respond to user interactions, allowing developers to use custom Shapes as buttons and other interactive UI elements.
Rather than introducing a completely separate system, we could explore building on the existing Shape geometry and path conversion infrastructure.
Goals
Support pointer-based interactions with Shapes.
Enable hit-testing for existing Shape primitives.
Consider both filled and stroked regions during hit-testing.
Support hover, press, release and click interactions.
Allow multiple interactive Shapes to work together.
Explore interaction support for ShapeCollections.
Expected Outcome
Developers should be able to make p5.Shape objects interactive and use custom Shapes as buttons or other interactive elements.
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms.
I was thinking that instead of introducing a completely new approach, we could explore extending the existing p5.Shape functionality.
We already have PrimitiveToPath2DConverter in `custom_shapes.js, which converts Shape primitives into Canvas Path2D objects. and the existing geometry infrastructure. One possibility is to build on these for hit-testing using Canvas APIs like isPointInPath() and isPointInStroke(). Do you think this would be a good direction, or should we explore other approaches?
I think we could start with hit-testing for the existing primitives, validate that approach, and then build pointer interactions on top of it. I'm open to alternatives if there's a better fit for the Shape system.
Bounding-box calculations could also be useful as the number of interactive Shapes grows. Do you think they're needed initially, or can we start with a simpler approach?
These are just my initial thoughts. I'd love to hear your perspectives!
Activity
welcome commentedon Nov 15, 2026
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms.
For guidance on contributing, check out our contributing guidelines and other resources for contributors.
💬 If you have questions or need support, feel free to join the Processing Foundation Forum or visit our Community page.
📜 Please also review our Code of Conduct to understand our community standards.
Thank You!
VANSH3104 commentedon Nov 15, 2026
Hey @ksen0, @diyaayay, @davepagurek, tagging you all here to get your thoughts on the initial approach.
I was thinking that instead of introducing a completely new approach, we could explore extending the existing
p5.Shapefunctionality.We already have
PrimitiveToPath2DConverterin `custom_shapes.js, which converts Shape primitives into CanvasPath2Dobjects. and the existing geometry infrastructure. One possibility is to build on these for hit-testing using Canvas APIs likeisPointInPath()andisPointInStroke(). Do you think this would be a good direction, or should we explore other approaches?I think we could start with hit-testing for the existing primitives, validate that approach, and then build pointer interactions on top of it. I'm open to alternatives if there's a better fit for the Shape system.
Bounding-box calculations could also be useful as the number of interactive Shapes grows. Do you think they're needed initially, or can we start with a simpler approach?
These are just my initial thoughts. I'd love to hear your perspectives!