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
Internet explorer SVG映射在Internet Explorer 10中工作不正常_Internet Explorer_Svg - Fatal编程技术网

Internet explorer SVG映射在Internet Explorer 10中工作不正常

Internet explorer SVG映射在Internet Explorer 10中工作不正常,internet-explorer,svg,Internet Explorer,Svg,我正在构建一个SVG地图动画。到目前为止,动画还不错,但我对IE上的SVG解释有问题。悬停路径是以一种奇怪的方式触发的(我认为这是在边界框上触发的),因此当所有地图就位时,会有一些路径完全被包围,无法触摸 我只是放了一块SVG,这样您就可以知道我在说什么: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" xml

我正在构建一个SVG地图动画。到目前为止,动画还不错,但我对IE上的SVG解释有问题。悬停路径是以一种奇怪的方式触发的(我认为这是在边界框上触发的),因此当所有地图就位时,会有一些路径完全被包围,无法触摸

我只是放了一块SVG,这样您就可以知道我在说什么:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg 
    xmlns="http://www.w3.org/2000/svg" 
    xmlns:xlink="http://www.w3.org/1999/xlink"  
    width="69.279999"
    height="105.34"
    viewBox="0 0 230.93362 351.1338">
  <style
     id="style3001">path { fill : blue } path:hover { fill : green }</style>
  <g
     transform="matrix(111.33376,0,0,116.46504,-16701.937,-16253.569)"
     id="g3003">
    <path       
       d="m 150.758,142.099 c -0.0517,0.0423 -0.10333,0.0847 -0.155,0.127 -0.0323,-0.0115 -0.0717,-0.0136 -0.0999,-0.0307 -0.024,-0.0436 -0.0573,-0.0849 -0.0756,-0.12979 0.009,-0.0523 0.003,-0.10875 0.0208,-0.15836 0.0344,-0.0743 0.0761,-0.14613 0.10581,-0.22198 0.005,-0.0414 0.0282,-0.0843 0.004,-0.12357 -0.0307,-0.0869 -0.0614,-0.17373 -0.0921,-0.2606 0.0173,-0.067 0.0347,-0.134 0.052,-0.201 -0.0558,-0.0445 -0.11683,-0.0847 -0.16951,-0.13191 -0.0118,-0.0328 -0.0427,-0.0635 -0.0418,-0.0978 0.0191,-0.0675 0.0299,-0.13837 0.054,-0.20374 0.0808,-0.13386 0.16153,-0.26771 0.2423,-0.40156 -0.0333,-0.0593 -0.0667,-0.11867 -0.1,-0.178 0.0429,-0.0125 0.0967,-0.004 0.12461,-0.045 0.0491,-0.048 0.0983,-0.096 0.14739,-0.14402 0.10933,0.15967 0.21867,0.31933 0.328,0.479 0.0641,0.0366 0.12439,0.0825 0.19078,0.11335 0.0454,0.01 0.0908,0.0198 0.13622,0.0297 0.0407,0.097 0.0813,0.194 0.122,0.291 -0.0197,0.10233 -0.0393,0.20467 -0.059,0.307 0.0963,0.072 0.19267,0.144 0.289,0.216 -0.0939,0.1481 -0.18414,0.29937 -0.28027,0.44549 -0.0662,0.0542 -0.13249,0.10834 -0.19873,0.16251 -0.0375,-0.003 -0.0637,-0.0198 -0.0742,-0.0569 -0.0264,-0.0418 -0.0373,-0.0973 -0.0859,-0.11945 -0.0274,-0.0195 -0.053,-0.0458 -0.0893,-0.0325 -0.0908,0.008 -0.18169,0.0152 -0.27253,0.0228 -0.0281,0.0458 -0.0638,0.0891 -0.0873,0.13651 -0.0128,0.0393 0.008,0.0627 0.0419,0.08 0.0366,0.0157 0.0475,0.0416 0.0314,0.0783 -0.003,0.0161 -0.006,0.0321 -0.009,0.0482 z"
    />
    </g>
</svg>

路径{填充:蓝色}路径:悬停{填充:绿色}
指针事件对此没有影响


欢迎任何帮助或建议。提前感谢。

这似乎是IE中的一个bug。它似乎与边界框无关,因为您可以在不触发翻滚的情况下侵入bbox内部的某些位置

起初我怀疑它可能使用贝塞尔控制点作为边界多边形,但当我将所有曲线转换为直线时,它仍然在发生

然后我怀疑这可能与转换有关,因此我创建了以下SVG来测试这一理论:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
  <style id="style3001">path { fill : blue; stroke-width: 0 } path:hover { fill : green }</style>
  <g>
    <path d="m 50,0 c 25,0 50,25 50,50 l 0,50 l -50,-25 l -50,25 l 0,-100 z" />
  </g>
</svg>

路径{填充:蓝色;笔划宽度:0}路径:悬停{填充:绿色}
瞧!它按预期工作

因此,如果您更改SVG以删除转换,而不是预乘坐标,您应该会发现它在IE中正常工作。希望您自己生成SVG,这样就很容易了。:)

接下来,似乎没有必要删除转换代码来解决这个IE问题。只要坐标值足够大(根据我的经验,大于1),鼠标悬停将正常工作

当然,为了使SVG不会因为这种解决方法而改变大小,需要将比例除以坐标乘以的相同因子

<!--IE Bug SVG-->
<svg height="200" width="150">
    <path id="path2" transform="translate(0,0)scale(1000)" d="M0.075 0 L0 0.2 L0.15 0.2 Z" />
</svg>

<!--Working SVG with scale and transform -->
<svg height="200" width="150">
    <path id="path1" transform="translate(0,0)scale(10)" d="M7.5 0 L0 20 L15 20 Z" />
</svg>


非常感谢。这是一个很大的工作,因为SVG略小于15MB。但是有这样的解决方案是很好的。我在这里问了一个类似的问题: