react-draggable-svg

0.0.3 • Public • Published

<DraggableSVG.x>

Install

npm i react-draggable-svg

Example

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

  1. function DraggableSVG(tagName): Component

  2. Draggable.g: Component

props

  1. 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

Readme

Keywords

Package Sidebar

Install

npm i react-draggable-svg

Weekly Downloads

10

Version

0.0.3

License

MIT

Last publish

Collaborators

  • heineiuo