Open GoogleCodeExporter opened 9 years ago
Original comment by steveonjava
on 25 Jun 2008 at 6:35
Here are some extra fixes to the reshape function to handle multiple cameras:
Index: extras/edu/umd/cs/piccolox/pswing/PSwing.java
===================================================================
--- extras/edu/umd/cs/piccolox/pswing/PSwing.java (revision 35)
+++ extras/edu/umd/cs/piccolox/pswing/PSwing.java (revision 36)
@@ -235,14 +235,24 @@
this(component);
}
+ void reshape() {
+ reshape(null);
+ }
+
/**
* Ensures the bounds of the underlying component are accurate, and sets the
bounds of this PNode.
+ * @param camera
*/
- void reshape() {
+ void reshape(PCamera camera) {
Rectangle2D swingBounds = getGlobalBounds();
- if (canvas != null) {
-
canvas.getCamera().getViewTransformReference().transform(swingBounds,
swingBounds);
+ if (camera == null && canvas != null) {
+ camera = canvas.getCamera();
}
+ if (canvas != null && !isDescendentOf(camera)) {
+ camera.globalToLocal(swingBounds);
+ camera.getViewTransformReference().transform(swingBounds,
swingBounds);
+ }
+
component.setBounds((int) swingBounds.getX(), (int) swingBounds.getY(),
component.getPreferredSize().width, component.getPreferredSize().height);
setBounds(0, 0, component.getPreferredSize().width,
component.getPreferredSize().height);
}
@@ -260,7 +270,7 @@
* @param renderContext Contains information about current render.
*/
public void paint(PPaintContext renderContext) {
- reshape();
+ reshape(renderContext.getCamera());
Graphics2D g2 = renderContext.getGraphics();
if (defaultStroke == null) {
Original comment by steveonjava
on 29 Jun 2008 at 11:27
Original comment by steveonjava
on 2 Jul 2008 at 12:28
Original comment by steveonjava
on 3 Jul 2008 at 5:05
Deferring to Milestone-2.0 per email from Steve.
Original comment by heue...@gmail.com
on 27 Oct 2009 at 1:02
Reverting back to New status
Original comment by heue...@gmail.com
on 31 Aug 2012 at 8:19
Original comment by heue...@gmail.com
on 31 Aug 2012 at 8:20
Original comment by heue...@gmail.com
on 31 Aug 2012 at 8:22
Original comment by heue...@gmail.com
on 26 Nov 2013 at 11:22
Original issue reported on code.google.com by
steveonjava
on 24 Jun 2008 at 8:09