All:
Suppose there are two layers( the top one is SVG:PATH, the bottom layer is a SVG:RECT, the top layer covers the bottom layer), I want to apply D3 drag to the RECT layer and mouseover to PATH layer, could anyone show me how to do that?
THE CODE BELOW CAN ONLY WORK WITH THE path LAYER:
var svg = d3.select("svg");
svg.style("width", "400px")
.style("height", "400px")
.style("border", "1px solid grey");
var r = svg.select("rect")
.attr("width", "300px")
.attr("height", "300px")
.attr("x", "50px")
.attr("y", "50px")
.style("fill", "whitesmoke");
var p = svg.select("path")
.attr("d", function(){
return "M0 0 L380 0 L300 300L0 380Z";
})
.style("fill", function(){
return "rgba(10,10,10,0.2)";
})
.on("mousedown", function(){
});
var drag = d3.behavior.drag();
var dragstart = function(){
alert("drag start");
};
drag.on("dragstart", );
r.call(drag);
Thanks