Unverified Commit e69f0940 authored by James Laver's avatar James Laver Committed by Nicolas Pouillard

make graph explorer camera manipulation compile

parent a1c7ab5d
......@@ -4,7 +4,7 @@ import Prelude
import Data.Nullable (Nullable)
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Effect.Uncurried (EffectFn1, EffectFn2, mkEffectFn1, runEffectFn2)
import React (Children, ReactClass, ReactElement, ReactRef, SyntheticEventHandler, createElement, unsafeCreateElement)
import Thermite (EventHandler)
import Unsafe.Coerce (unsafeCoerce)
......@@ -254,13 +254,14 @@ type Camera =
angle :: Number
}
foreign import applyOnCameraImpl :: SyntheticEventHandler (Nullable ReactRef)
applyOnCamera = applyOnCameraImpl
--foreign import applyOnCameraImpl :: forall a. EffectFn2 (Nullable ReactRef) (a -> EventHandler) Unit
-- applyOnCamera :: forall a. (Nullable ReactRef) -> (a -> EventHandler) -> Effect Unit
-- applyOnCamera = runEffectFn2 applyOnCameraImpl
-- foreign import applyOnCameraImpl :: EffectFn2 (a → b) (Nullable ReactRef)
-- applyOnCamera = applyOnCameraImpl
foreign import applyOnCameraImpl :: forall a. EffectFn2 (Nullable ReactRef) (a -> EventHandler) Unit
applyOnCamera :: forall a. (a -> EventHandler) -> EffectFn1 (Nullable ReactRef) Unit
applyOnCamera a = mkEffectFn1 h
where h :: Nullable ReactRef -> Effect Unit
h r = runEffectFn2 applyOnCameraImpl r a
type SigmaProps =
( renderer :: Renderer
, settings :: SigmaSettings
......
......@@ -209,8 +209,8 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
, settings
, renderer : canvas
, style : sStyle { height : "96%"}
, ref: applyOnCamera
--, ref: flip applyOnCamera $ d <<< SaveCamera
-- , ref: applyOnCamera
, ref: applyOnCamera $ (d <<< SaveCamera)
, onClickNode : \e -> unsafePerformEffect $ do
_ <- log "this should be deleted"
-- _ <- logs $ unsafeCoerce e
......@@ -535,8 +535,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
[ sigma { graph, settings
, renderer : canvas
, style : sStyle { height : "95%"}
, ref: applyOnCamera
-- , ref: flip applyOnCamera $ d <<< SaveCamera
, ref: applyOnCamera (d <<< SaveCamera)
, onClickNode : \e -> unsafePerformEffect $ do
_ <- log " hello 2"
--logs $ unsafeCoerce e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment