在Firefox中拖动/选择SVG [英] Dragging/selecting inside SVG in Firefox

查看:98
本文介绍了在Firefox中拖动/选择SVG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个使用嵌入式SVG作为其基本UI元素的Web应用程序. UI的一些操作包括在SVG中选择文本,以及在SVG上拖动.这适用于Webkit和Presto,但是Gecko拒绝合作.当我尝试在Firefox中跨SVG拖动时,它会启动整个SVG图像的拖动动作.有办法防止这种默认行为吗?

I am making a web-application which uses an inline SVG as its basic UI element. Some of the UI actions include selecting the text in the SVG, and dragging across the SVG. This works in Webkit and Presto, but Gecko refuses to cooperate. When I try to drag across the SVG in Firefox, it initiates a drag action with the whole SVG image. Is there a way to prevent this default behaviour?

推荐答案

以下错误报告中描述了此行为: https://bugzilla.mozilla.org/show_bug.cgi?id=525591

This behaviour is described in the following bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=525591

您可以通过在事件上调用preventDefault()来解决此问题.

You can fix this by calling preventDefault() on the event.

这确实需要在某个地方的FAQ中找到.

This really needs to go in an FAQ somewhere.

这篇关于在Firefox中拖动/选择SVG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆