Permalink
Browse files

added support for parent to all shapes

  • Loading branch information...
1 parent 3d13c37 commit 1c90e960da94bc56600aca83d4a97e84c9ff7063 @dnewcome committed Apr 13, 2012
Showing with 15 additions and 0 deletions.
  1. +1 −0 arc.js
  2. +1 −0 circle.js
  3. +1 −0 ellipse.js
  4. +1 −0 line.js
  5. +10 −0 tests/api.html
  6. +1 −0 text.js
View
1 arc.js
@@ -41,6 +41,7 @@ Donatello.Arc = function( parent, x, y, r, t1, t2, a ) {
clip.style[ Donatello.transform + 'Origin' ]= '100% 100%';
parent.dom.appendChild( clip );
+ this._parent = parent;
this.dom = clip;
// attr calls draw ...
// this.attr( a );
View
@@ -19,6 +19,7 @@ Donatello.Circle = function( parent, x, y, r, a ) {
};
var el = Donatello.createElement( x-r-s, y-r-s, 2*r, 2*r, 'div');
parent.dom.appendChild( el );
+ this._parent = parent;
this.dom = el;
// attr calls draw ...
this.attr( a );
View
@@ -19,6 +19,7 @@ Donatello.Ellipse = function( parent, x, y, rx, ry, a ) {
};
var el = Donatello.createElement( x-rx-s, y-ry-s, 2*rx, 2*ry, 'div');
parent.dom.appendChild( el );
+ this._parent = parent;
this.dom = el;
// attr calls draw ...
this.attr( a );
View
@@ -26,6 +26,7 @@ Donatello.Line = function( parent, x, y, dx, dy, a ) {
this.attrMap['stroke'] = 'borderTopColor';
this.dom = el;
+ this._parent = parent;
this.draw( a );
View
@@ -4,6 +4,8 @@
<!-- test the donatello api features. -->
<script src="../donatello.js" type="text/javascript"></script>
<script src="../rect.js" type="text/javascript"></script>
+ <script src="../circle.js" type="text/javascript"></script>
+ <script src="../text.js" type="text/javascript"></script>
<script>
var line;
@@ -25,6 +27,14 @@
paper
.rect( 20, 20, 50, 50, attrs ).parent()
.rect( 40, 40, 50, 50, attrs );
+
+ paper
+ .circle( 20, 20, 10, attrs ).parent()
+ .circle( 40, 40, 10, attrs );
+
+ paper
+ .text( 20, 20, "foo" ).parent()
+ .text( 40, 40, "bar" );
}
</script>
View
@@ -24,6 +24,7 @@ Donatello.Text = function( parent, x, y, str, a ) {
this.dom = el;
this.draw();
+ this._parent = parent;
parent.dom.appendChild( el );
this.attr( a );

0 comments on commit 1c90e96

Please sign in to comment.