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 ...@@ -4,7 +4,7 @@ import Prelude
import Data.Nullable (Nullable) import Data.Nullable (Nullable)
import Effect (Effect) 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 React (Children, ReactClass, ReactElement, ReactRef, SyntheticEventHandler, createElement, unsafeCreateElement)
import Thermite (EventHandler) import Thermite (EventHandler)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
...@@ -254,13 +254,14 @@ type Camera = ...@@ -254,13 +254,14 @@ type Camera =
angle :: Number angle :: Number
} }
foreign import applyOnCameraImpl :: SyntheticEventHandler (Nullable ReactRef) -- foreign import applyOnCameraImpl :: EffectFn2 (a → b) (Nullable ReactRef)
applyOnCamera = applyOnCameraImpl -- applyOnCamera = applyOnCameraImpl
--foreign import applyOnCameraImpl :: forall a. EffectFn2 (Nullable ReactRef) (a -> EventHandler) Unit foreign import applyOnCameraImpl :: forall a. EffectFn2 (Nullable ReactRef) (a -> EventHandler) Unit
-- applyOnCamera :: forall a. (Nullable ReactRef) -> (a -> EventHandler) -> Effect Unit
-- applyOnCamera = runEffectFn2 applyOnCameraImpl
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 = type SigmaProps =
( renderer :: Renderer ( renderer :: Renderer
, settings :: SigmaSettings , settings :: SigmaSettings
......
...@@ -209,8 +209,8 @@ render d p (State {sigmaGraphData, settings, legendData}) c = ...@@ -209,8 +209,8 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
, settings , settings
, renderer : canvas , renderer : canvas
, style : sStyle { height : "96%"} , style : sStyle { height : "96%"}
, ref: applyOnCamera -- , ref: applyOnCamera
--, ref: flip applyOnCamera $ d <<< SaveCamera , ref: applyOnCamera $ (d <<< SaveCamera)
, onClickNode : \e -> unsafePerformEffect $ do , onClickNode : \e -> unsafePerformEffect $ do
_ <- log "this should be deleted" _ <- log "this should be deleted"
-- _ <- logs $ unsafeCoerce e -- _ <- logs $ unsafeCoerce e
...@@ -535,8 +535,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render'] ...@@ -535,8 +535,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
[ sigma { graph, settings [ sigma { graph, settings
, renderer : canvas , renderer : canvas
, style : sStyle { height : "95%"} , style : sStyle { height : "95%"}
, ref: applyOnCamera , ref: applyOnCamera (d <<< SaveCamera)
-- , ref: flip applyOnCamera $ d <<< SaveCamera
, onClickNode : \e -> unsafePerformEffect $ do , onClickNode : \e -> unsafePerformEffect $ do
_ <- log " hello 2" _ <- log " hello 2"
--logs $ unsafeCoerce e --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