1

I have an external svg that I embed via an tag. I then use javascript to insert mouse handlers to -s in order to "rotate" them with the mouse. (Just like knobs on a stereo.)

Now, every once in a while, this doesn't work. Firefox then doesn't show the drag-cursor which I told it to show but instead the crossed-out-circle cursor. Also, it doesn't rotate meaning that the javascript is not run. This happens roughly every third time - other times it works great.

To me, it looks like firefox tries to drag the whole svg-object instead of handing the mouse-events over to the javascript and let that do it's magic.

Does that sound familiar to anybody? What could I do?

Cheers!


Okay, short time after, although I had searched the web, I found the answer myself.

This works just like Dragging/selecting inside SVG in Firefox.

Let me quote from there:

This behaviour is described in the following bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=525591 You can fix this by calling preventDefault() on the event. This really needs to go in an FAQ somewhere.

I have nothing to add :-)

4

1 回答 1

1

好的,不久之后,虽然我搜索了网络,但我自己找到了答案。

这就像在 Firefox 中的 SVG 中拖动/选择一样。

让我从那里引用:

以下错误报告中描述了此行为:https ://bugzilla.mozilla.org/show_bug.cgi?id= 525591 您可以通过在事件上调用 preventDefault() 来修复此问题。这确实需要在某个地方的常见问题解答中进行。

我没有什么要补充的:-)

于 2012-09-20T07:22:11.667 回答