Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created July 11, 2012 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/3087559 to your computer and use it in GitHub Desktop.
Save roundrobin/3087559 to your computer and use it in GitHub Desktop.
just another inlet to tributary
var Baushaus = function(){
this.svg = g;
}
Baushaus.prototype.mergeOptions = function(element, options){ for(option in options){ element.attr(option,options[option]); } };
Baushaus.prototype.circle = function(r,x,y,options){
var elem = this.svg.append('circle').attr('r',r);
elem.attr('cx',x)
elem.attr('cy',y)
if(options) this.mergeOptions(elem,options);
return elem;
};
Baushaus.prototype.rect = function(w,h,options){ return this.svg.append('rect').attr('width',w).attr('height',h) };
Baushaus.prototype.square = function(s,options){ return this.svg.append('rect').attr('width',s).attr('height',s)};
var b = new Baushaus();
b.circle(54,167,147)
b.circle(113,374,147)
var fo = g.append('foreignobject')
var body = fo.append('body').attr('xmlns','http://www.w3.org/1999/xhtml')
var form = body.append('form')
form.append('p').text('sdfsdfsd')
form.append('input')
.attr('type','text')
.attr('width',200)
.attr('height',200)
.style('background-color','#ff00f')
fo.attr('x',200)
.attr('y',200)
.attr('width',200)
.attr('height',200)
.attr('fill','red')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment