0.0.15-s5 • Published 2 years ago

@nomorejalapenos/draggable-react v0.0.15-s5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Vanilla

import { useDraggable } from '@nomorejalapenos/draggable-react'

export default function App() {
  const target = useRef<HTMLDivElement>(null!)
  const container = useRef<HTMLDivElement>(null!)

  useDraggable({
    target,
    container,
    smoothness: 7,
  })

  const containerStyle: CSSProperties = {
    position: 'absolute',
    top: 'calc(50% - 20vmin)',
    left: 'calc(50% - 30vmin)',
    width: '60vmin',
    height: '40vmin',
    backgroundColor: 'lightblue',
    touchAction: 'none',
  }

  const targetStyle: CSSProperties = {
    width: '10vmin',
    height: '10vmin',
    backgroundColor: 'tomato',
  }

  return (
    <div
      style={containerStyle}
      ref={container}
    >
      <div
        style={targetStyle}
        ref={target}
      ></div>
    </div>
  )
}
0.0.15-s5

2 years ago

0.0.14-s5

2 years ago

0.0.13-s5

2 years ago

0.0.12-s5

2 years ago

0.0.12-s4

2 years ago

0.0.11-s4

2 years ago

0.0.1-s4

2 years ago

0.0.1-s3

2 years ago

0.0.1-s2

2 years ago

0.0.1-s1

2 years ago

0.0.1

2 years ago