[PD] datastruct: moving the position off a object

Frank Barknecht fbar at footils.org
Wed Jul 12 17:27:53 CEST 2006


Hallo,
moritz hat gesagt: // moritz wrote:

> i'm going trough the docs about datastructure, but i dont have a 
> solution yet to move the position with the mouse, of a polygon without 
> going in edit-mode.(i have also checked franks structsequenzer, there 
> the rectangles can also only be moved in edit-mode).
> So, i want to have a simpel rectangle where i can move it (with mouse) 
> the position, the "size" of it, without going in edit-mode...
> is it possible?

There are two ways currently. One is to use an array-field instead of
a plain polygon. Array elements can be moved outside of edit mode (and
they can't be moved on their own inside edit mode).

The other solution would be to use relative variables to control
screen position. That is, you define a struct like this: 

[struct rect float x float y float x0 float y0]

Then you keep x and y at (0,0) but use x0 and y0 as the points where
you draw your rectangle. Drawing a rectangle then must be done with
the scaling notation. Here's how I did this in "control.pd" that was
posted on this list several times in the past: 

[filledpolygon 0 999 1 x0(0:200)(0:200) y0(0:200)(0:200)
x0(0:200)(10:210) y0(0:200)(0:200) x0(0:200)(10:210) y0(0:200)(10:210)
x0(0:200)(0:200) y0(0:200)(10:210)]

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__




More information about the Pd-list mailing list