Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
0ef30a74
Unverified
Commit
0ef30a74
authored
Feb 28, 2019
by
Mael NICOLAS
Committed by
Nicolas Pouillard
Apr 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[HELP] can't call the callback function
parent
e69f0940
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
21 deletions
+22
-21
Sigmajs.js
src/Gargantext/Components/GraphExplorer/Sigmajs.js
+7
-11
Graph.purs
src/Gargantext/Pages/Corpus/Graph.purs
+15
-10
No files found.
src/Gargantext/Components/GraphExplorer/Sigmajs.js
View file @
0ef30a74
...
...
@@ -40,17 +40,13 @@ exports.forceLinkClass = FL.default;
}
const
applyOnCamera
=
function
(
props
){
console
.
log
(
props
);
//const camera = props.sigma.cameras[0];
//f(camera)
const
applyOnCamera
=
function
(
props
,
f
){
if
(
props
!=
null
)
{
const
camera
=
props
.
sigma
.
cameras
[
0
];
// console.log(camera);
// console.log(f);
f
(
camera
);
}
};
/*const applyOnCamera = function(props, f){
console.log(props);
//const camera = props.sigma.cameras[0];
//f(camera)
};
*/
exports
.
applyOnCameraImpl
=
applyOnCamera
;
src/Gargantext/Pages/Corpus/Graph.purs
View file @
0ef30a74
...
...
@@ -25,6 +25,7 @@ import Effect.Aff (Aff, attempt)
import Effect.Aff.Class (liftAff)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Effect.Uncurried (runEffectFn1, runEffectFn2)
import Gargantext.Components.GraphExplorer.Sigmajs (Camera, Color(Color), SigmaEasing, SigmaGraphData(SigmaGraphData), SigmaNode, SigmaSettings, canvas, edgeShape, edgeShapes, forceAtlas2, applyOnCamera, sStyle, sigma, sigmaEasing, sigmaEdge, sigmaEnableWebGL, sigmaNode, sigmaSettings)
import Gargantext.Components.GraphExplorer.Types (Cluster(..), MetaData(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
...
...
@@ -130,8 +131,10 @@ initialState = State
-- This one is not used: specOld is the one being used.
-- TODO: code duplication
{-
graphSpec :: Spec State {} Action
graphSpec = simpleSpec performAction render
-}
performAction :: PerformAction State {} Action
performAction (LoadGraph fp) _ _ = void do
...
...
@@ -183,7 +186,7 @@ performAction (SaveCamera c) _ _ =
-- State $
convert :: GraphData -> SigmaGraphData
convert (GraphData r) = SigmaGraphData {
nodes, edges}
convert (GraphData r) = SigmaGraphData {nodes, edges}
where
nodes = mapWithIndex nodeFn r.nodes
nodeFn i (Node n) =
...
...
@@ -199,7 +202,7 @@ convert (GraphData r) = SigmaGraphData { nodes, edges}
cDef (Cluster {clustDefault}) = clustDefault
edges = map edgeFn r.edges
edgeFn (Edge e) = sigmaEdge {id : e.id_, source : e.source, target : e.target}
{--
render :: Render State {} Action
render d p (State {sigmaGraphData, settings, legendData}) c =
case sigmaGraphData of
...
...
@@ -210,7 +213,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
, renderer : canvas
, style : sStyle { height : "96%"}
-- , ref: applyOnCamera
, ref: applyOnCamera $
(d <<< SaveCamera)
, ref: applyOnCamera $
d <<< SaveCamera
, onClickNode : \e -> unsafePerformEffect $ do
_ <- log "this should be deleted"
-- _ <- logs $ unsafeCoerce e
...
...
@@ -226,6 +229,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
-- TODO clean unused code: this seems to be not used
-- <>
-- [dispLegend legendData]
--}
forceAtlas2Config :: { slowDown :: Number
, startingIterations :: Number
...
...
@@ -535,13 +539,14 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
[ sigma { graph, settings
, renderer : canvas
, style : sStyle { height : "95%"}
, ref: applyOnCamera (d <<< SaveCamera)
, onClickNode : \e -> unsafePerformEffect $ do
_ <- log " hello 2"
--logs $ unsafeCoerce e
_ <- d $ ShowSidePanel true
_ <- d $ SelectNode $ SelectedNode {id : (unsafeCoerce e).data.node.id, label : (unsafeCoerce e).data.node.label}
pure unit
, ref: applyOnCamera log -- d <<< SaveCamera
, onClickNode : \e ->
unsafePerformEffect $ do
_ <- log " hello 2"
_ <- log $ show st.camera
_ <- d $ ShowSidePanel true
_ <- d $ SelectNode $ SelectedNode {id : (unsafeCoerce e).data.node.id, label : (unsafeCoerce e).data.node.label}
pure unit
}
[ sigmaEnableWebGL
, forceAtlas2 forceAtlas2Config
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment