Forums > Jitter

Allow Drag but disable rotation using jit.gl.handle

April 26, 2007 | 10:53 pm

Hi,

I am using opengl to create a canvas where 2 Dimensional shapes can be dragged around. I thought of using the jit.gl.handle object but I don’t want the objects to rotate, just drag. Is there a way to tell the object not to allow rotation? (or a different way of acheiving this?) I can’t see anything to suggest there is in the documentation. If so, is there also a way of getting the object to drag without having to hold the shift/apple key?

Thanks

Andy


April 26, 2007 | 11:14 pm

> the jit.gl.handle object but I don’t want the objects to rotate,
> just drag. Is there a way to tell the object not to allow rotation?
> (or a different way of acheiving this?) I can’t see anything to
> suggest there is in the documentation.

since jit.gl.handle only generates control messages you can easily
filter out the rotation with [route]

#P toggle 20 27 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 20 52 51 196617 qmetro 1;
#P newex 20 104 82 196617 jit.gl.render foo;
#P newex 20 130 75 196617 jit.window foo;
#P newex 171 115 32 196617 print;
#P newex 117 74 65 196617 route rotate;
#P newex 117 42 182 196617 jit.gl.handle foo @inherit_transform 1;
#P connect 1 1 4 0;
#P connect 1 1 2 0;
#P connect 0 0 1 0;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P window clipboard copycount 7;

> If so, is there also a way of getting the object to drag without
> having to hold the shift/apple key?

in that case you can build it yourself from the mouseposition:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 201 121 95 196617 jit.gl.gridshape foo;
#P message 121 344 238 196617 position 0.2925 0.008333 0.;
#P newex 121 327 62 196617 prepend set;
#P newex 20 74 50 196617 t b erase;
#P newex 85 295 83 196617 prepend position;
#P newex 85 239 104 196617 pack 0. 0. 0.;
#P newex 196 211 92 196617 scale 0 240 1. -1.;
#P newex 85 211 107 196617 scale 0 320 -1.3 1.3;
#P newex 85 182 58 196617 unpack 0 0;
#P newex 85 155 65 196617 route mouse;
#P toggle 20 27 15 0;
#P newex 20 52 51 196617 qmetro 1;
#P newex 20 104 82 196617 jit.gl.render foo;
#P newex 20 130 75 196617 jit.window foo;
#P window linecount 2;
#P comment 312 204 100 196617 adjust for window size and aspect ratio;
#P fasten 10 0 2 0 90 320 5 320 5 95 25 95;
#P connect 10 0 12 0;
#P hidden connect 12 0 13 0;
#P connect 6 1 8 0;
#P connect 8 0 9 1;
#P connect 11 1 2 0;
#P connect 11 0 2 0;
#P connect 3 0 11 0;
#P connect 9 0 10 0;
#P connect 7 0 9 0;
#P connect 6 0 7 0;
#P connect 5 0 6 0;
#P connect 1 1 5 0;
#P connect 4 0 3 0;
#P window clipboard copycount 15;

hth

/*j


April 26, 2007 | 11:25 pm

Thats great. Thanks. Should really have thought of that. My only problem now is making it affect only one of multiple slabs.

Thanks for yor help

Andy


April 27, 2007 | 9:58 am

I have a feeling that I am going about this completely wrong. Essentially what I am trying to do is create something that works similar to the tcl/tk canvas widget (if you know the one). My requirements are only in 2 dimensions so maybe I’m over complicating it by using openGL.


April 27, 2007 | 12:20 pm


Viewing 5 posts - 1 through 5 (of 5 total)