So we still use [get], we just don't use [element] anymore to select the scalar. There i was not clear in one previous post.
-
Data structures: [append] and [get] -- what am I getting wrong?
-
As far as constrained dragging, you can do it in Purr Data fairly easily:
As far as constrained dragging on array elements, you can do that in Purr Data as well:
A few notes:
- the "drag" event is set on the relevant
[draw]
command and sends notifications to the outlet of the relevant[draw]
command. This allows "per-shape" events so you can tell which shape triggered the event. - since these draw events aren't turned on by default, you can decide which events you want to listen for-- mousedown, mouseup, mouseover, mouseout, mouseenter, mouseleave, and drag. (Scroll and touch events are possible but I haven't implemented them.)
- for the sake of sanity "x" and "y" fields don't have any automatic behavior when scalar elements are drawn using
[draw array]
. If you want to make associations you can declare them in a message as I do in the demo. [draw array]
has no bounding box to select it in Edit mode. Otherwise it would try to get the bounding box for all its elements and cause dropouts for arrays of non-trivial size every time you move the mouse. To get a bbox you can nest it inside a[draw svg]
which creates a viewport clipped to a rectangle you can specify.- receiving events for ds array elements is fairly new behavior. I know there's at least one crasher lurking if you try to add fields to the [struct] for an array element with extant scalars on a canvas.
Edit: clarification
- the "drag" event is set on the relevant
-
hi,
I've got a purrdata patch that uses draw-array with per-shape events. it's really great for user definded interaction.
Here's what I've got so far: