UNPKG

ldx-widgets

Version:

widgets

32 lines (21 loc) 558 B
React = require 'react' {div} = React.DOM Draggable = React.createClass displayName: 'Draggable' getDefaultProps: -> centerOnCursor: true render: -> {position, component, options, className, centerOnCursor, height, width} = @props {x, y} = position if centerOnCursor x = x - width / 2 y = y - (height - height / 2) div { className: "draggable #{className or ''}" style: top: y left: x height: height width: width }, component(options) module.exports = Draggable