vialab / SMT

Simple Multi-Touch (SMT) Toolkit
http://vialab.science.uoit.ca/smt
GNU General Public License v3.0
43 stars 18 forks source link

Move parent zone without child zone #207

Open ecopika opened 10 years ago

ecopika commented 10 years ago

Hey guys!!

I'm trying to drag a parent zone and keep the child zone statically, and I can't find any solution.

I will be very glad, if anybody can help me with this.

EcoPik@

kiwistrongis commented 10 years ago

Um, the whole point of the parent/children thing is that the child inherits its parent's transformations. Anyways, I guess this is how you'd do it:

void touchParent( Zone zone){
  PVector v1 = child.getOrigin();
  parent.drag();
  PVector v2 = child.getOrigin();
  PVector difference = PVector.sub( v1, v2);
  child.translate( difference.x, difference.y);
}