Svg viewbox没有';t在Firefox中使用嵌套svg返回正确的鼠标点
当我尝试获取鼠标位置时,FirefoxV25没有什么问题。 当我使用2个svg嵌套时,FF没有返回正确的位置,但在Chrome和IE10中工作良好 这是一个例子:Svg viewbox没有';t在Firefox中使用嵌套svg返回正确的鼠标点,svg,Svg,当我尝试获取鼠标位置时,FirefoxV25没有什么问题。 当我使用2个svg嵌套时,FF没有返回正确的位置,但在Chrome和IE10中工作良好 这是一个例子: 啊,但是Firefox确实给出了正确的位置,其他浏览器和你的算法才是问题所在。这是问题线 svgPoint = svgPoint.matrixTransform(svgElement.getScreenCTM().inverse()); svgElement与svgPoint处于不同的坐标系中,因为svgElement有一个vie
啊,但是Firefox确实给出了正确的位置,其他浏览器和你的算法才是问题所在。这是问题线
svgPoint = svgPoint.matrixTransform(svgElement.getScreenCTM().inverse());
svgElement与svgPoint处于不同的坐标系中,因为svgElement有一个viewBox,不幸的是IE和Chrome不符合此处的SVG规范,这导致了很多混乱
你可以写下这句话,而不是上面的那一行
svgPoint = svgPoint.matrixTransform(followRectElement.getScreenCTM().inverse());
由于下面的矩形元素位于所需的坐标系中,因此该解决方案可以跨浏览器工作
svgPoint = svgPoint.matrixTransform(svgElement.getScreenCTM().inverse());
svgPoint = svgPoint.matrixTransform(followRectElement.getScreenCTM().inverse());