We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm doing a "for-fun" side project that involves drawing control p5 elements inside my own custom "Windows" (Essentially just rectangles). Essentially this is mimicking an OS ui, as these early screenshots suggests:
Now I'm planning on implementing the ability to drag these windows around, but as I was plotting it out in my head I realized that having overlapping elements could potentially cause issues with drawing and event handling. I figure I could solve drawing order with setAutoDraw(false), but I'm wondering how the library figures out which controller I'm clicking on if two are overlapping (E.g. If I drag a window full of controllers on top of another window of controllers). Essentially, how do I ensure that it clicks the button on top.
Does it have anything to do with drawing order or initialization? Is there some priority order or depth I can manipulate to allow certain controllers to be checked before others when overlapping? Am I over-thinking this? Am I misunderstanding the way this works?
I get that this may not necessarily be what cp5 is intended for, but it's such a fantastic library that I'd love to be able to make it work for this.
TL;DR - If two cp5 controllers overlap, and I click within a region shared by both, how does cp5 decide which one I've clicked on? And how can I ensure that the topmost controller is the one that is clicked?