我试图追加一个"块"到现有的svg并对这个添加的"块"。
应用转换这是我的测试代码。我用一个按钮来触发事件:
$("#insert_prodotto_daxml").click(function() {
$.ajax({
url : "assets/materiale/singolo_CLOUD_inkMATTEO.svg",
dataType: "text",
success : function (data) {
var svg = d3.select("svg");
var blocksect = d3.select("svg").append('defs');
// provo ad aggiungere dinamicamente la definizione da stringa xml
var newblock = blocksect.append("g").attr("id", "block01");
newblock.html(data);
//svg.append("g").attr("transform","translate(30,50)").append("use").attr("xlink:href","#block01").on("click", handleClickBlock)
//svg.append("g").attr("transform","translate(0, -100) scale(3)").append("use").attr("xlink:href","#block01").on("click", handleClickBlock)
svg.append("g").attr("transform","translate(0, 0) scale(1,1)").append("use").attr("xlink:href","#block01").on("click", handleClickBlock)
svg.append("g").attr("transform","translate(100, 30) scale(1.5)").append("use").attr("xlink:href","#block01").on("click", handleClickBlock)
}
});
});
之前的代码工作正常,但如果我尝试镜像元素,将至少一个比例因子更改为负数,则不会显示该元素:
svg.append("g").attr("transform","translate(0, 0) scale(1,-1)").append("use").attr("xlink:href","#block01").on("click", handleClickBlock)
是否支持负值?
亲切的问候, 马特