Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created December 11, 2012 05:47
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/4256180 to your computer and use it in GitHub Desktop.
Save roundrobin/4256180 to your computer and use it in GitHub Desktop.
Absolut Position Tes
{"description":"Absolut Position Tes","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.5929687500000002,"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");
var g1 = svg.append("svg:g")
.attr("transform","translate("+[0,0]+")")
.attr("class","group");
g1.append("rect")
.attr("width", 100)
.attr("height", 100)
.attr("x", 100)
.attr("y", 100)
.attr("rx", 15)
.style("fill", "#1F00FF")
.style("fill-opacity", 0.5)
.style("stroke", "#0033FF")
.style("stroke-width", 5)
var g1 = svg.append("svg:g")
.attr("transform","translate("+[100,0]+")")
.attr("class","group");
var g2 = g1.append("svg:g")
.attr("transform","translate("+[100,0]+")")
.attr("class","group");
var box = g2.append("rect")
.attr("width", 100)
.attr("height", 100)
.attr("x", 100)
.attr("y", 0)
.attr("rx", 15)
.style("fill", "#114461")
.style("fill-opacity", 0.5)
.style("stroke", "#434C70")
.style("stroke-width", 5)
.attr("transform","translate("+[100,0]+")");
var bb = box.node().getBBox();
var clientRect = box.node().getBoundingClientRect();
console.log(bb.x, clientRect.left);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment