为raphael svg路径创建一个边界框

时间:2014-07-04 13:02:58

标签: jquery html svg raphael draggable

我正在使用raphael.js(2.1.2)和raphael.sketchpad.js来绘制svg路径。 我希望在svg路径周围使用getBBox来制作边界框,以便我可以在其上应用各种操作(选择,拖动)。

以下是绘制小行时生成的代码

    <svg height="7866" version="1.1" width="857" xmlns="http://www.w3.org/2000/svg" id="svg_id" style="overflow: hidden; position: absolute; z-index: 3; pointer-events: visiblepainted; left: -0.09375px; top: 0px; -webkit-user-select: text;">

    <desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-user-select: text;"></desc>

    <defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-user-select: text;"></defs>

    <path fill="none" stroke="#000000" d="M160.90625,62L160.90625,63L162.90625,65L162.90625,70L163.90625,74L163.90625,
76L163.90625,78L163.90625,79" stroke-opacity="1" stroke-width="2" 
stroke-linecap="round" stroke-linejoin="round" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); stroke-opacity: 1; 
stroke-linecap: round; stroke-linejoin: round; -webkit-user-select: text;"></path>

    </svg>

我的问题是如何首先为每个svg路径元素创建边界框? 还会在哪里制作?如果我想让路径可拖动,那么边界框会以任何方式帮助我吗?

任何帮助都将非常感谢!!

0 个答案:

没有答案