Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created December 11, 2012 18:58
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/4261044 to your computer and use it in GitHub Desktop.
Save roundrobin/4261044 to your computer and use it in GitHub Desktop.
Another Inlet
{"description":"Another Inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.5203125000000002,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false}
var svg = d3.select("svg");
function SVGInputField(wrapper){
this.history = [];
this.wrapper = wrapper;
}
SVGInputField.nrOfInstances = 0;
SVGInputField.createInputfield = function(width, height,x,y){
try{
SVGInputField.nrOfInstances+= 1;
var wrapper = d3.select("svg").append('g')
.attr('id','svg-input-field-wrapper-'+SVGInputField.nrOfInstances)
.attr("transform","translate("+[x,y]+")");
var rect = wrapper.append('rect')
.attr({'width': width,
'height' : height,
'x': 0,
'y': 0,
'fill':'#888'});
var text_input = wrapper.append('svg:text')
.text('Hello World')
.attr({'font-size':20})
.attr("transform","translate("+[0,20]+")");;
return new SVGInputField(wrapper);
}catch(e){
}
};
SVGInputField.prototype.sayHello = function()
{
console.log('hello');
};
SVGInputField.createInputfield(100,100,100,100);
SVGInputField.createInputfield(100,100,101,257);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment