Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何将图像作为墙砖放置在svg路径中_Angularjs_Svg - Fatal编程技术网

Angularjs 如何将图像作为墙砖放置在svg路径中

Angularjs 如何将图像作为墙砖放置在svg路径中,angularjs,svg,Angularjs,Svg,嗨,我有一个svg路径,我将从中放置图像。当我把它的显示放在路径的中心,并没有按照我想要的图像填充其他区域 如何将图像作为瓷砖放置在墙上 <defs> <pattern id="img1" patternUnits="userSpaceOnUse" width="100" height="100"> <image x="0" y="0" xlink:href="stile.jpg" width="100" height="100" /> &

嗨,我有一个svg路径,我将从中放置图像。当我把它的显示放在路径的中心,并没有按照我想要的图像填充其他区域

如何将图像作为瓷砖放置在墙上

<defs>
  <pattern  id="img1" patternUnits="userSpaceOnUse" width="100" height="100">
    <image x="0" y="0" xlink:href="stile.jpg"  width="100" height="100" />
  </pattern>
</defs>
 <path d="M 752 180 v 192 h 215 V 145 L 752 180 Z M 916 358 l -130 0.246 v -78.369 L 916 270 V 358 Z"/>
</path>



 <script>
jQuery(function($){
    $('path').click(function(){


       this.style.fill = "url(#img1)";
        alert(this.id);
    });
});
</script>

jQuery(函数($){
$('path')。单击(函数(){
this.style.fill=“url(#img1)”;
警报(this.id);
});
});

当我用jquery点击路径时,我在上面应用图像填充任何形状

<rect width="100%" height="100%" fill="url(#img1)" /> 


问题是您的图像有白色边框。如果要使用该图像,需要将图像放入一个符号中,该符号带有一个裁剪图像白色边框的视口,如下所示:



但我有我要通过pattern@Rahulking将路径代码添加到您的问题中,我将完善我的答案我已经更新了代码。我点击路径并使用jqueryi在其上应用图像如果我有多条路径,我是否需要更改所有路径的变换值?@Rahul king从您的附加条件中了解到,与初始条件相比,问题的内容完全不同。你已经回答了最初的问题。因此,您必须选择并接受现有答案,并在另一个主题中使用所有新条件提出新问题。当我单击path时,jquery用ImageUpdate路径填充区域。在本例中,您填充路径。我已经更新了我的答案,以说明如何更新。请看一看,他们正在为此使用画布,但SVG是一个很好的选择。您能建议我需要使用什么来创建类似的应用程序吗?但他们正在使用SVG,因为画布不支持单击和其他事件