Skip to content

Instantly share code, notes, and snippets.

@ryantrinkle
Created September 3, 2015 21:33
Show Gist options
  • Save ryantrinkle/7b16a6a2af5a8a3658e8 to your computer and use it in GitHub Desktop.
Save ryantrinkle/7b16a6a2af5a8a3658e8 to your computer and use it in GitHub Desktop.
import GHCJS.DOM
import GHCJS.DOM.Document
import GHCJS.DOM.Element
import GHCJS.DOM.Event
import GHCJS.DOM.EventM
import GHCJS.DOM.MouseEvent
import GHCJS.DOM.Types
import Control.Monad
import Control.Monad.IO.Class
main = runWebGUI $ \webView -> do
Just doc <- liftM (fmap castToHTMLDocument) $ webViewGetDomDocument webView
Just body <- documentGetBody doc
elementSetAttribute body "style" "position:absolute;width:100%;height:100%"
elementOnmousedown body $ do
e <- event
x <- liftIO $ mouseEventGetX e
y <- liftIO $ mouseEventGetY e
liftIO $ print (x, y)
return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment