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
Show 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;
...
@@ -40,17 +40,13 @@ exports.forceLinkClass = FL.default;
}
}
const
applyOnCamera
=
function
(
props
){
const
applyOnCamera
=
function
(
props
,
f
){
console
.
log
(
props
);
if
(
props
!=
null
)
{
//const camera = props.sigma.cameras[0];
const
camera
=
props
.
sigma
.
cameras
[
0
];
//f(camera)
// 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
;
exports
.
applyOnCameraImpl
=
applyOnCamera
;
src/Gargantext/Pages/Corpus/Graph.purs
View file @
0ef30a74
...
@@ -25,6 +25,7 @@ import Effect.Aff (Aff, attempt)
...
@@ -25,6 +25,7 @@ import Effect.Aff (Aff, attempt)
import Effect.Aff.Class (liftAff)
import Effect.Aff.Class (liftAff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Console (log)
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.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.GraphExplorer.Types (Cluster(..), MetaData(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
...
@@ -130,8 +131,10 @@ initialState = State
...
@@ -130,8 +131,10 @@ initialState = State
-- This one is not used: specOld is the one being used.
-- This one is not used: specOld is the one being used.
-- TODO: code duplication
-- TODO: code duplication
{-
graphSpec :: Spec State {} Action
graphSpec :: Spec State {} Action
graphSpec = simpleSpec performAction render
graphSpec = simpleSpec performAction render
-}
performAction :: PerformAction State {} Action
performAction :: PerformAction State {} Action
performAction (LoadGraph fp) _ _ = void do
performAction (LoadGraph fp) _ _ = void do
...
@@ -183,7 +186,7 @@ performAction (SaveCamera c) _ _ =
...
@@ -183,7 +186,7 @@ performAction (SaveCamera c) _ _ =
-- State $
-- State $
convert :: GraphData -> SigmaGraphData
convert :: GraphData -> SigmaGraphData
convert (GraphData r) = SigmaGraphData {
nodes, edges}
convert (GraphData r) = SigmaGraphData {nodes, edges}
where
where
nodes = mapWithIndex nodeFn r.nodes
nodes = mapWithIndex nodeFn r.nodes
nodeFn i (Node n) =
nodeFn i (Node n) =
...
@@ -199,7 +202,7 @@ convert (GraphData r) = SigmaGraphData { nodes, edges}
...
@@ -199,7 +202,7 @@ convert (GraphData r) = SigmaGraphData { nodes, edges}
cDef (Cluster {clustDefault}) = clustDefault
cDef (Cluster {clustDefault}) = clustDefault
edges = map edgeFn r.edges
edges = map edgeFn r.edges
edgeFn (Edge e) = sigmaEdge {id : e.id_, source : e.source, target : e.target}
edgeFn (Edge e) = sigmaEdge {id : e.id_, source : e.source, target : e.target}
{--
render :: Render State {} Action
render :: Render State {} Action
render d p (State {sigmaGraphData, settings, legendData}) c =
render d p (State {sigmaGraphData, settings, legendData}) c =
case sigmaGraphData of
case sigmaGraphData of
...
@@ -210,7 +213,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
...
@@ -210,7 +213,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
, renderer : canvas
, renderer : canvas
, style : sStyle { height : "96%"}
, style : sStyle { height : "96%"}
-- , ref: applyOnCamera
-- , ref: applyOnCamera
, ref: 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
...
@@ -226,6 +229,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
...
@@ -226,6 +229,7 @@ render d p (State {sigmaGraphData, settings, legendData}) c =
-- TODO clean unused code: this seems to be not used
-- TODO clean unused code: this seems to be not used
-- <>
-- <>
-- [dispLegend legendData]
-- [dispLegend legendData]
--}
forceAtlas2Config :: { slowDown :: Number
forceAtlas2Config :: { slowDown :: Number
, startingIterations :: Number
, startingIterations :: Number
...
@@ -535,10 +539,11 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
...
@@ -535,10 +539,11 @@ 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 (d <<< SaveCamera)
, ref: applyOnCamera log -- d <<< SaveCamera
, onClickNode : \e -> unsafePerformEffect $ do
, onClickNode : \e ->
unsafePerformEffect $ do
_ <- log " hello 2"
_ <- log " hello 2"
--logs $ unsafeCoerce e
_ <- log $ show st.camera
_ <- d $ ShowSidePanel true
_ <- d $ ShowSidePanel true
_ <- 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
...
...
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