added back in some x-y positioning code
authoradam <adam@megacz.com>
Sat, 11 Mar 2006 11:06:42 +0000 (11:06 +0000)
committeradam <adam@megacz.com>
Sat, 11 Mar 2006 11:06:42 +0000 (11:06 +0000)
darcs-hash:20060311110642-5007d-e3540dcede9d3376e6d36cee2c110fd81e45ebb7.gz

src/org/ibex/core/Box.java

index 396a2b6..b9f71b6 100644 (file)
@@ -173,8 +173,6 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain {
     public void constrain(Box b, Affine a) {
         contentwidth = 0;
         contentheight = 0;
-        transform.e = 0;
-        transform.f = 0;
         a = a.copy().premultiply(transform);
 
         //boolean relevant = packed() || ((fillcolor&0xff000000)!=0x0) || path!=null;
@@ -192,10 +190,16 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain {
         for(Box child = getChild(0); child != null; child = child.nextSibling()) {
             xmin = Integer.MAX_VALUE; ymin = Integer.MAX_VALUE;
             xmax = Integer.MIN_VALUE; ymax = Integer.MIN_VALUE;
+            if (packed()) {
+                child.transform.e = 0;
+                child.transform.f = 0;
+            }
             child.constrain(this, Affine.identity());
             if (xmin==Integer.MAX_VALUE||xmax==Integer.MIN_VALUE||ymin==Integer.MAX_VALUE||ymax== Integer.MIN_VALUE) continue;
-            child.transform.e = -1 * xmin;
-            child.transform.f = -1 * ymin;
+            if (packed()) {
+                child.transform.e = -1 * xmin;
+                child.transform.f = -1 * ymin;
+            }
             contentwidth += (xmax-xmin);
             contentheight = max(ymax-ymin, contentheight);
         }
@@ -401,10 +405,12 @@ public final class Box extends JS.Obj implements Callable, Mesh.Chain {
             dirty();
             polygon = null;
         }
+        case "x":           transform.e = JSU.toInt(value);
+        case "y":           transform.f = JSU.toInt(value);
         case "transform":   {
             transform = Affine.parse(JSU.toString(value));
-            transform.e = 0;
-            transform.f = 0;
+            //transform.e = 0;
+            //transform.f = 0;
             if (getSurface() != null)  // FIXME
                 getSurface().dirty(0, 0, getSurface().root.contentwidth, getSurface().root.contentheight);
             REPLACE();