Skip to content

Commit

Permalink
Merge branch 'tripp/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tripp committed Jul 27, 2011
2 parents f4fdd67 + d3d641a commit 8b725a0
Show file tree
Hide file tree
Showing 18 changed files with 1,194 additions and 1,038 deletions.
68 changes: 31 additions & 37 deletions build/graphics-canvas/graphics-canvas-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ CanvasDrawing.prototype = {
node.style.left = (x + this._left) + "px";
node.style.top = (y + this._top) + "px";
},

/**
* Holds queue of properties for the target canvas.
*
* @property _properties
* @type Object
* @private
*/
_properties: null,

/**
* Queues up a method to be executed when a shape redraws.
Expand Down Expand Up @@ -1164,22 +1155,6 @@ Y.extend(CanvasShape, Y.BaseGraphic, Y.mix({
{
this._addTransform("scale", arguments);
},

/**
* Applies a matrix transformation
*
* @method matrix
* @param {Number} a
* @param {Number} b
* @param {Number} c
* @param {Number} d
* @param {Number} dx
* @param {Number} dy
*/
matrix: function(a, b, c, d, dx, dy)
{
this._addTransform("matrix", arguments);
},

/**
* Storage for `rotation` atribute.
Expand All @@ -1189,6 +1164,15 @@ Y.extend(CanvasShape, Y.BaseGraphic, Y.mix({
* @private
*/
_rotation: 0,

/**
* Storage for the transform attribute.
*
* @property _transform
* @type String
* @private
*/
_transform: "",

/**
* Adds a transform to the shape.
Expand All @@ -1201,9 +1185,10 @@ Y.extend(CanvasShape, Y.BaseGraphic, Y.mix({
_addTransform: function(type, args)
{
args = Y.Array(args);
this._transform = Y_LANG.trim(this._transform + " " + type + "(" + args.join(", ") + ")");
args.unshift(type);
this._transforms.push(args);
if(this.initialized)
if(this.initialized)
{
this._updateTransform();
}
Expand Down Expand Up @@ -1596,23 +1581,32 @@ CanvasShape.ATTRS = {
return [0.5, 0.5];
}
},

/**
* The rotation (in degrees) of the shape.
/**
* A css transform string.
*
* @config rotation
* @type Number
* @config transform
* @type String
*
* @writeOnly
*/
rotation: {
transform: {
setter: function(val)
{
this.rotate(val);
this.matrix.init();
this._transforms = this.matrix.getTransformArray(val);
this._transform = val;
if(this.initialized)
{
this._updateTransform();
}
return val;
},

getter: function()
{
return this._rotation;
}
getter: function()
{
return this._transform;
}
},

/**
Expand Down
8 changes: 4 additions & 4 deletions build/graphics-canvas/graphics-canvas-min.js

Large diffs are not rendered by default.

68 changes: 31 additions & 37 deletions build/graphics-canvas/graphics-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ CanvasDrawing.prototype = {
node.style.left = (x + this._left) + "px";
node.style.top = (y + this._top) + "px";
},

/**
* Holds queue of properties for the target canvas.
*
* @property _properties
* @type Object
* @private
*/
_properties: null,

/**
* Queues up a method to be executed when a shape redraws.
Expand Down Expand Up @@ -1164,22 +1155,6 @@ Y.extend(CanvasShape, Y.BaseGraphic, Y.mix({
{
this._addTransform("scale", arguments);
},

/**
* Applies a matrix transformation
*
* @method matrix
* @param {Number} a
* @param {Number} b
* @param {Number} c
* @param {Number} d
* @param {Number} dx
* @param {Number} dy
*/
matrix: function(a, b, c, d, dx, dy)
{
this._addTransform("matrix", arguments);
},

/**
* Storage for `rotation` atribute.
Expand All @@ -1189,6 +1164,15 @@ Y.extend(CanvasShape, Y.BaseGraphic, Y.mix({
* @private
*/
_rotation: 0,

/**
* Storage for the transform attribute.
*
* @property _transform
* @type String
* @private
*/
_transform: "",

/**
* Adds a transform to the shape.
Expand All @@ -1201,9 +1185,10 @@ Y.extend(CanvasShape, Y.BaseGraphic, Y.mix({
_addTransform: function(type, args)
{
args = Y.Array(args);
this._transform = Y_LANG.trim(this._transform + " " + type + "(" + args.join(", ") + ")");
args.unshift(type);
this._transforms.push(args);
if(this.initialized)
if(this.initialized)
{
this._updateTransform();
}
Expand Down Expand Up @@ -1596,23 +1581,32 @@ CanvasShape.ATTRS = {
return [0.5, 0.5];
}
},

/**
* The rotation (in degrees) of the shape.
/**
* A css transform string.
*
* @config rotation
* @type Number
* @config transform
* @type String
*
* @writeOnly
*/
rotation: {
transform: {
setter: function(val)
{
this.rotate(val);
this.matrix.init();
this._transforms = this.matrix.getTransformArray(val);
this._transform = val;
if(this.initialized)
{
this._updateTransform();
}
return val;
},

getter: function()
{
return this._rotation;
}
getter: function()
{
return this._transform;
}
},

/**
Expand Down
65 changes: 30 additions & 35 deletions build/graphics-svg/graphics-svg-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,15 +769,11 @@ Y.extend(SVGShape, Y.BaseGraphic, Y.mix({
h = this.get("height"),
rotation = fill.rotation,
radCon = Math.PI/180,
sinRadians = parseFloat(parseFloat(Math.sin(rotation * radCon)).toFixed(8)),
cosRadians = parseFloat(parseFloat(Math.cos(rotation * radCon)).toFixed(8)),
tanRadians = parseFloat(parseFloat(Math.tan(rotation * radCon)).toFixed(8)),
i,
len,
def,
stop,
x = this.get("x"),
y = this.get("y"),
x1 = "0%",
x2 = "100%",
y1 = "0%",
Expand Down Expand Up @@ -983,22 +979,6 @@ Y.extend(SVGShape, Y.BaseGraphic, Y.mix({
this._addTransform("scale", arguments);
},

/**
* Applies a matrix transformation
*
* @method matrix
* @param {Number} a
* @param {Number} b
* @param {Number} c
* @param {Number} d
* @param {Number} dx
* @param {Number} dy
*/
matrix: function(a, b, c, d, dx, dy)
{
this._addTransform("matrix", arguments);
},

/**
* Adds a transform to the shape.
*
Expand All @@ -1010,6 +990,7 @@ Y.extend(SVGShape, Y.BaseGraphic, Y.mix({
_addTransform: function(type, args)
{
args = Y.Array(args);
this._transform = Y_LANG.trim(this._transform + " " + type + "(" + args.join(", ") + ")");
args.unshift(type);
this._transforms.push(args);
if(this.initialized)
Expand All @@ -1029,10 +1010,7 @@ Y.extend(SVGShape, Y.BaseGraphic, Y.mix({
var isPath = this._type == "path",
node = this.node,
key,
args,
val,
transform,
test,
transformOrigin,
x,
y,
Expand Down Expand Up @@ -1145,6 +1123,15 @@ Y.extend(SVGShape, Y.BaseGraphic, Y.mix({
* @private
*/
_translateY: 0,

/**
* Storage for the transform attribute.
*
* @property _transform
* @type String
* @private
*/
_transform: "",

/**
* Returns the bounds for a shape.
Expand Down Expand Up @@ -1172,7 +1159,6 @@ Y.extend(SVGShape, Y.BaseGraphic, Y.mix({
d = matrix.d,
dx = matrix.dx,
dy = matrix.dy,
transformOrigin = this.get("transformOrigin"),
w = this.get("width"),
h = this.get("height"),
//The svg path element does not have x and y coordinates. Shapes based on path use translate to "fake" x and y. As a
Expand Down Expand Up @@ -1274,23 +1260,32 @@ SVGShape.ATTRS = {
return [0.5, 0.5];
}
},

/**
* The rotation (in degrees) of the shape.
/**
* A css transform string.
*
* @config rotation
* @type Number
* @config transform
* @type String
*
* @writeOnly
*/
rotation: {
transform: {
setter: function(val)
{
this.rotate(val);
this.matrix.init();
this._transforms = this.matrix.getTransformArray(val);
this._transform = val;
if(this.initialized)
{
this._updateTransform();
}
return val;
},

getter: function()
{
return this._rotation;
}
getter: function()
{
return this._transform;
}
},

/**
Expand Down
6 changes: 3 additions & 3 deletions build/graphics-svg/graphics-svg-min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 8b725a0

Please sign in to comment.