Unverified Commit 0874fa1b authored by Mael NICOLAS's avatar Mael NICOLAS Committed by Nicolas Pouillard

[WIP] made a basic ref

Revolved last bug, i was writing in the wrong renderer (we really need to
factorise this code)
parent 49c2ce3a
...@@ -41,7 +41,7 @@ exports.forceLinkClass = FL.default; ...@@ -41,7 +41,7 @@ exports.forceLinkClass = FL.default;
} }
const myGoto = function(sigma){ const myGoto = function(sigma){
console.log("My goto ffi"); const camera = sigma.sigma.cameras[0];
}; };
exports.myGoto = myGoto; exports.myGoto = myGoto;
...@@ -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 React (Children, ReactClass, ReactElement, ReactRef, createElement, unsafeCreateElement) import React (Children, ReactClass, ReactElement, ReactRef, SyntheticEventHandler, createElement, unsafeCreateElement)
import React.DOM.Props (Props) import React.DOM.Props (Props)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Types (class Optional) import Gargantext.Types (class Optional)
...@@ -244,14 +244,14 @@ sigmaSettings :: forall o. Optional o SigmaSettingProps => { | o } -> SigmaSetti ...@@ -244,14 +244,14 @@ sigmaSettings :: forall o. Optional o SigmaSettingProps => { | o } -> SigmaSetti
sigmaSettings = unsafeCoerce sigmaSettings = unsafeCoerce
foreign import data SigmaStyle :: Type foreign import data SigmaStyle :: Type
foreign import myGoto :: Nullable ReactRef -> Effect Unit foreign import myGoto :: SyntheticEventHandler (Nullable ReactRef)
type SigmaProps = type SigmaProps =
( renderer :: Renderer ( renderer :: Renderer
, settings :: SigmaSettings , settings :: SigmaSettings
, style :: SigmaStyle , style :: SigmaStyle
, graph :: SigmaGraphData , graph :: SigmaGraphData
, ref :: Nullable ReactRef -> Effect Unit , ref :: SyntheticEventHandler (Nullable ReactRef)
, onClickNode :: SigmaNodeEvent -> Unit , onClickNode :: SigmaNodeEvent -> Unit
, onOverNode :: SigmaNodeEvent -> Unit , onOverNode :: SigmaNodeEvent -> Unit
, onOutNode :: SigmaNodeEvent -> Effect Unit , onOutNode :: SigmaNodeEvent -> Effect Unit
......
...@@ -191,10 +191,10 @@ render d p (State {sigmaGraphData, settings, legendData}) c = ...@@ -191,10 +191,10 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
Just graph -> Just graph ->
[ sigma { graph, settings [ sigma { graph, settings
, renderer : canvas , renderer : canvas
, style : sStyle { height : "95%"} , style : sStyle { height : "96%"}
, ref: myGoto , ref: myGoto
, onClickNode : \e -> unsafePerformEffect $ do , onClickNode : \e -> unsafePerformEffect $ do
_ <- log "hello" _ <- log "this should be deleted"
-- _ <- logs $ unsafeCoerce e -- _ <- logs $ unsafeCoerce e
_ <- d $ SelectNode $ SelectedNode {id : (unsafeCoerce e).data.node.id, label : (unsafeCoerce e).data.node.label} _ <- d $ SelectNode $ SelectedNode {id : (unsafeCoerce e).data.node.id, label : (unsafeCoerce e).data.node.label}
pure unit pure unit
...@@ -512,7 +512,8 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render'] ...@@ -512,7 +512,8 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
Just graph -> Just graph ->
[ sigma { graph, settings [ sigma { graph, settings
, renderer : canvas , renderer : canvas
, style : sStyle { height : "95%"} , style : sStyle { height : "96%"}
, ref: myGoto
, 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