Quartz Composer Selection Rectangle Queue

PeMo's picture

I'm attempting to create a type of 'selection rectangle' using Quartz Composer, without much luck. My approach has been to use the GL Quad Patch, with X1Y1 vertex values set by mouse XY coords and a left click; I then want to store that value and then be able to resize the Quad (X3Y3 vertex) and click and set that - thus defining the rectangular selection area. X2Y2 & X4Y4 correspond to the previous two defined corners of the quad.

However - there seem to be a million ways to do this and I'm simply not sure which is best/simplest - using inbuilt patches, custom patches (e.g. Kineme data tools) or the Javascript Patch. I'd really like to be able to click and define a series of non-contiguous selections running across e.g. a graph, but am currently stumped as to how to do this. I've created a queue structure that records sampled XY coords and left clicks, but how to assign these to the correct vertices of more than one quad defeats me at the moment.

Any suggestions welcome - happy to supply more details.

benoitlahoz's picture
Re: Quartz Composer Selection Rectangle Queue

Here's a comp with a rectangle selection and a "contain" test.

It uses Sample & Hold patch for the first point. If you want to store the resulting rectangle, you'll have (not tested) to trigger a Queue sample input when the mouse button becomes false again (use a Watcher and a condition).

PreviewAttachmentSize
recta_selection.qtz41.45 KB

PeMo's picture
Re: Quartz Composer Selection Rectangle Queue

Merci Benoit! - that's terrific - some really useful stuff in there I'll adapt/incorporate. :)

I've also devised a solution for a proportional selector (with no contain test), suitable for selecting ranges from queued items in structures or visualised data etc that can be deployed in a variety of contexts. It returns quad vertex feedback for various uses.

PS it needs the Origami plugins to work (Interaction 2)

PreviewAttachmentSize
selector_info.qtz102.06 KB