PShape mode CENTER fucks iFrame position
Diex opened this issue · comments
si no haces esto, el frame se te vuela de la pantalla si usas modo CENTER.
esto es usando
frame.setShape(ps);
pgraphics.shapeMode(CENTER);
frame.draw(pgraphics);
si en Shape.java haces:
26: shp.draw(pg); // needs to handle recorder too
27: if (pg.shapeMode == PApplet.CENTER) {
28: // Si no haces esto, la transformación se te acumula
29: iFrame.translate(shp.getWidth() / 2, shp.getHeight() / 2);
30: pg.popMatrix();
31: }
32: }
silly me (silly you maybe) :)
I think you should do:
File:
20: pg.flush();
21: if (pg.shapeMode == PApplet.CENTER) {
22: pg.pushMatrix();
23: // iFrame.translate(-shp.getWidth() / 2, -shp.getHeight() / 2);
24: pg.translate(-shp.getWidth() / 2, -shp.getHeight() / 2);
25: }
26:
Thanks for reporting it. I just pushed the fix. Please confirm that it's working now.
hey ! nice to see you...
No, actually yes but it fucks the picking mechanism. frame picking occurs when your mouse is w/2, h/2 in the oposite direction (ie: as it is rendered I think as CORNER - default behaviour)
by the way: what "android" src I need to add to my buildPath in order to avoid:
defMotionAgent = new DroidTouchAgent(this); // DroidTouchAgent cannot be resolved... blabla
I was using a former commit (no android at all)
kind regards !
dx
hmmh picking uses the color of the picking buffer so I don't see how it's related. Could you please provide a little example reproducing the issue? In the mean time you can try frame.center()
(which can also be bound to a key shortcut)
To set up the eclipse project for android:
- Download the android mode from your pde. It will land to
sketchbook/modes/AndroidMode
- In eclipse set up an ANDROID_LIB variable pointing to:
sketchbook/modes/AndroidMode/sdk/platforms/android-23/android.jar
nice to see you too ;)
I'll try but it is a huge eclipse project I'm working on. but I should try cause maybe my code is doing wrong.
mtf!!! Error during download and install of Android Mode.
:)
done. but still doing wrong picking. how does actually picking works? (briefly)
check this out (give it a couple minutes to process):
https://www.youtube.com/watch?v=soG3m3vb4e4
using scene.setPickingVisualHint(true); seems to work but picking does not.
I'm not familiar with shape CENTER mode, but did you try to set it for the iFrame.pickingShape too?
what do you mean?
when I create it I do (in a InteractiveFrame subclass):
{
super(scn);
setPosition(pos.x, pos.y, pos.z);
removeBindings();
setMotionBinding(MouseAgent.LEFT_ID, "translate");
PShape ps = scn.pApplet().loadShape("cross.svg");
setPickingShape(ps);
setFrontShape(ps);
}
then for drawing:
pgraphics.shapeMode(CENTER);
iframe.draw(pgraphics);
I cant find where the picking buffer is updated or where the
"scene().unchachedBuffer = true;" is then cached again...
got it:
scene.pickingBuffer().shapeMode(PApplet.CENTER);
extremely fucking weird buddy !!! :)
(let me know if annoys you me using the f word.)
un abrazo !
dx