Hi Patrick,
For unrotated rectangles its easy, for other shapes of GUI objects is not so easy.
Basically each abstraction figures out the upper-right and lower-left coords of the bounding box. This is based on the position/size of the object (using gemlist_list). Actually when I did this gemlist_info did not exist so I was doing crazy things to approximate the position of those corner points.
Then you just compare the position of the mouse to the position those corners:
Xlower <= Xmouse <= Xupper Ylower <= Ymouse <= Yupper
Then you can do things like trap a click when that state is true, measure the distance from the centre of the object and the mouse-pointer, and use that to translate the object so that it gets "grabbed" in the position you click...
Mind you I was making draggable boxes... not sliders, but its about the same problem...
I've posted a feature request for doing this kind of stuff so that it can be Gem that senses if a point in space is inside or outside of a gem object, no matter its shape or orientation. It should also be 3D so that you can do this with 3D cursors...
But actually gemlist_info makes this way easier than it used to be, still I have no idea how to test if a point is in the bounds of a sphere!
I can make a simple demo if your stuck...
.b.
patrick wrote:
hi all,
i was thinking about using gem for some gui stuff like slider, radio, number, playlist, bang etc. i think the hardest part is to integrate the mouse interaction (click-drag...)?
pat
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list