0.0.3 • Published 8 years ago
react-draggable-svg v0.0.3
<DraggableSVG.x>
Install
npm i react-draggable-svgExample
import React, { Component } from 'react'
import DraggableSVG from 'react-draggable-svg'
ReactDOM.reander(
<svg>
<DraggableSVG.g
onDragStart={() => console.log('drag start'))}
onDragOver={() => { console.log('on drag over') } }
onDrop={() => { console.log('on drop') }}
>
<rect>
<text>hello world</text>
</rect>
</DraggableSVG.g>
</svg>
)API
function DraggableSVG(tagName): ComponentDraggable.g: Component
props
- renderDragElement: func
Render custom element when dragging. Because <g>, <rect> can only show inside <svg>, so you should custom a svg element wrap this child element.
License
MIT