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;
}
const myGoto = function(sigma){
console.log("My goto ffi");
const camera = sigma.sigma.cameras[0];
};
exports.myGoto = myGoto;
......@@ -4,7 +4,7 @@ import Prelude
import Data.Nullable (Nullable)
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 Unsafe.Coerce (unsafeCoerce)
import Gargantext.Types (class Optional)
......@@ -244,14 +244,14 @@ sigmaSettings :: forall o. Optional o SigmaSettingProps => { | o } -> SigmaSetti
sigmaSettings = unsafeCoerce
foreign import data SigmaStyle :: Type
foreign import myGoto :: Nullable ReactRef -> Effect Unit
foreign import myGoto :: SyntheticEventHandler (Nullable ReactRef)
type SigmaProps =
( renderer :: Renderer
, settings :: SigmaSettings
, style :: SigmaStyle
, graph :: SigmaGraphData
, ref :: Nullable ReactRef -> Effect Unit
, ref :: SyntheticEventHandler (Nullable ReactRef)
, onClickNode :: SigmaNodeEvent -> Unit
, onOverNode :: SigmaNodeEvent -> Unit
, onOutNode :: SigmaNodeEvent -> Effect Unit
......
......@@ -191,10 +191,10 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
Just graph ->
[ sigma { graph, settings
, renderer : canvas
, style : sStyle { height : "95%"}
, style : sStyle { height : "96%"}
, ref: myGoto
, onClickNode : \e -> unsafePerformEffect $ do
_ <- log "hello"
_ <- log "this should be deleted"
-- _ <- logs $ unsafeCoerce e
_ <- d $ SelectNode $ SelectedNode {id : (unsafeCoerce e).data.node.id, label : (unsafeCoerce e).data.node.label}
pure unit
......@@ -512,7 +512,8 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
Just graph ->
[ sigma { graph, settings
, renderer : canvas
, style : sStyle { height : "95%"}
, style : sStyle { height : "96%"}
, ref: myGoto
, 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