Sorry if this doesn't belong here, not sure if goog Closure api issue, or
compilation
I define CanvasGraphics object:
(def canvas (graphics/CanvasGraphics. 640 960)
<... render canvas to an element >
I try to attach a MOUSEMOVE event
(.listen canvas
(.-MOUSEMOVE goog.events/EventType)
(fn [e] (let [trgt (.-currentTarget e)
x (- (.-clientX e) (.-offsetLeft trgt))
y (- (.-clientY e) (.-offsetTop trgt))
upd (dom/getElement "cursors")]
(set! (.-innerHTML upd) (.join (array x "x" y) " ")))))
This event should update "cursors" element with current cursor position.
But event does not fire, ever.
If I attach event to a CanvasGraphics container (that I use .render method on)
events get fired properly, however, it's not an acceptable solution, since
container element has overflow:scroll and is smaller than canvas itself, thus
resulting in incorrect cursor positions.
What is a 'de-facto' library for handling dom / events in ClojureScript? Should
I stop using Closure libraries?
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.