Unverified Commit 43e812aa authored by Mael NICOLAS's avatar Mael NICOLAS Committed by Nicolas Pouillard

[HELP] big issue that make computer crash!!

if you compile and go to graph, navigator will crash.
This is probably due with the call of dispatch(d) in Graph.purs.
Work perfectly fine with log instead of dispatch.
parent 0ef30a74
...@@ -45,7 +45,7 @@ const applyOnCamera = function(props, f){ ...@@ -45,7 +45,7 @@ const applyOnCamera = function(props, f){
const camera = props.sigma.cameras[0]; const camera = props.sigma.cameras[0];
// console.log(camera); // console.log(camera);
// console.log(f); // console.log(f);
f(camera); f(camera)();
} }
}; };
......
...@@ -254,14 +254,13 @@ type Camera = ...@@ -254,14 +254,13 @@ type Camera =
angle :: Number angle :: Number
} }
-- foreign import applyOnCameraImpl :: EffectFn2 (a → b) (Nullable ReactRef)
-- 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. (a -> EventHandler) -> EffectFn1 (Nullable ReactRef) Unit applyOnCamera :: forall a. (a -> EventHandler) -> EffectFn1 (Nullable ReactRef) Unit
applyOnCamera a = mkEffectFn1 h applyOnCamera a = mkEffectFn1 h
where h :: Nullable ReactRef -> Effect Unit where h :: Nullable ReactRef -> Effect Unit
h r = runEffectFn2 applyOnCameraImpl r a h r = runEffectFn2 applyOnCameraImpl r a
type SigmaProps = type SigmaProps =
( renderer :: Renderer ( renderer :: Renderer
, settings :: SigmaSettings , settings :: SigmaSettings
......
...@@ -179,7 +179,8 @@ performAction DisplayEdges _ _ = ...@@ -179,7 +179,8 @@ performAction DisplayEdges _ _ =
performAction (SaveCamera c) _ _ = performAction (SaveCamera c) _ _ =
modifyState_ $ \(State s) -> do modifyState_ $ \(State s) -> do
State $ ((_camera) .~ (Just c)) s State $ ((_camera) .~ cam) s
where cam = Just {x: 0.0, y: 0.0, ratio: 0.0, angle: 0.0}
--performAction (Zoom True) _ _ = --performAction (Zoom True) _ _ =
-- modifyState_ $ \() -> do -- modifyState_ $ \() -> do
...@@ -539,7 +540,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render'] ...@@ -539,7 +540,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 log -- d <<< SaveCamera , ref: applyOnCamera $ d <<< SaveCamera
, onClickNode : \e -> , onClickNode : \e ->
unsafePerformEffect $ do unsafePerformEffect $ do
_ <- log " hello 2" _ <- log " hello 2"
......
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