Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.07 KB

README.md

File metadata and controls

43 lines (30 loc) · 1.07 KB

om-draggable

A draggable meta-component with a few different dragging behaviors: free-drag, grid-snap-drag, and guideline-snap-drag.

Demo

Run the visualize example to get a sense of the draggable behaviors:

lein cljsbuild once
python -m SimpleHTTPServer 4005
open http://localhost:4005/examples/visualize/

Usage

(ns visualize.core
  (:require [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer put! close!]]
            [draggable.core :as dnd]
            [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true])
  (:require-macros [cljs.core.async.macros :as am :refer [go go-loop alt!]]))

(def app {:top 10
          :left 10
          :sub-com block-com
          :sub-com-data {:color %1
                         :size %2}
          :snap-threshold 25})

(om/root dnd/draggable
         app
         {:opts {:dragger-fn (fn [owner _]
                               (dnd/free-drag owner (:snap-threshold app)))}})

LICENSE

All code released under the MIT license

Copyright

BUSHIDO INC. 2014