Status: New
Owner: [email protected]
Labels: Priority-Low
New issue 227 by [email protected]: PCanvas.setCamera() sets new Camera's
bounds to Canvas bounds
http://code.google.com/p/piccolo2d/issues/detail?id=227
Consider this code that replaces the camera on a PCanvas:
PCanvas canvas = new PCanvas();
PCamera camera = PUtil.createBasicScenegraph();
canvas.setCamera(camera); //*
canvas.setPanEventHandler(new PPanEventHandler());
canvas.setZoomEventHandler(new PZoomEventHandler());
The new camera's bounds are set by the PCanvas.setCamera() method to be the
bounds of the PCanvas. If PCanvas is a component of some JComponent, J, it
may have bounds with (x,y) not equal to (0,0) (if J's layout manager
repositions it.)
This seems to be undesirable behavior. (In a simple scenegraph the side
effect is that after replacing the camera the camera renders the layer
starting at some offset (whatever the PCanvas's (x,y) offset is)).
It seems that PCanvas.setCamera() should the camera's bounds to be
(0,0,canvas.width,canvas.height).
(Easy workaround: just set the camera's bounds yourself after replacing the
camera.)
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en