Add anchorAtPosition to preserve position when setting anchor.
[featherfall2.git] / src / yuu / rdr.js
index a03cbec..552d593 100644 (file)
                 b[3] = b[7] = b[11] = b[15] = a;
                 this._vbuf.dirty = true;
             }
+        },
+
+        anchorAtPosition: {
+            get: function () { return this.anchor; },
+            set: function (a) {
+                var position = this.position;
+                this.anchor = a;
+                this.position = position;
+            }
         }
     });
 
         constructor: function (material) {
             var buffer = new yuu.VertexBuffer(yuu.V3T2C4_F, 4);
             this._quad = new yuu.Quad(buffer);
+            material = yf.isString(material)
+                ? new yuu.Material(material)
+                : material;
             this._rdro = new yuu.Renderable(
                 buffer, yuu.gl.TRIANGLE_STRIP, material,
                 { model: mat4.create() }, 0.0);
         size: { alias: "_quad.size", chainable: true },
         position: { alias: "_quad.position", chainable: true },
         anchor: { alias: "_quad.anchor", chainable: true },
+        anchorAtPosition: { alias: "_quad.anchorAtPosition", chainable: true },
         xy: { alias: "_quad.position", chainable: true },
         texBounds: { alias: "_quad.texBounds", chainable: true },
         color: { alias: "_quad.color", chainable: true },