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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
ce88d2c0
Commit
ce88d2c0
authored
Oct 21, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] implement disabling of camera based on FA2
parent
3f3693fb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
20 deletions
+33
-20
Button.purs
src/Gargantext/Components/Bootstrap/Inline/Button.purs
+10
-10
Buttons.purs
src/Gargantext/Components/GraphExplorer/Toolbar/Buttons.purs
+12
-10
Controls.purs
...Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
+1
-0
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+10
-0
No files found.
src/Gargantext/Components/Bootstrap/Inline/Button.purs
View file @
ce88d2c0
...
...
@@ -20,24 +20,24 @@ type Props =
)
type Options =
( status :: ComponentStatus
, size :: Sizing
, variant :: ButtonVariant
, type :: String
( block :: Boolean
, className :: String
, block :: Boolean
, size :: Sizing
, status :: ComponentStatus
, title :: String
, type :: String
, variant :: ButtonVariant
)
options :: Record Options
options =
{ status : Enabled
, size : MediumSize
, variant : ButtonVariant Primary
, type : "button"
{ block : false
, className : ""
, block : false
, status : Enabled
, size : MediumSize
, title : ""
, type : "button"
, variant : ButtonVariant Primary
}
-- | Structural Component for the Bootstrap button
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Buttons.purs
View file @
ce88d2c0
...
...
@@ -60,11 +60,12 @@ centerButton sigmaRef = B.button
------------------------------------------------------
type CameraButtonProps =
( id :: Int
, hyperdataGraph :: GET.HyperdataGraph
, reloadForest :: T2.ReloadS
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
( id :: Int
, hyperdataGraph :: GET.HyperdataGraph
, forceAtlasState :: SigmaxTypes.ForceAtlasState
, reloadForest :: T2.ReloadS
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
)
screenshotFilename :: Effect String
...
...
@@ -80,21 +81,21 @@ cameraButtonCpt :: R.Component CameraButtonProps
cameraButtonCpt = here.component "cameraButton" cpt
where
cpt { id
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData hyperdataGraph }
, forceAtlasState
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData graphData' }
, reloadForest
, session
, sigmaRef } _ = do
pure $ B.button
{ callback: \_ -> do
filename <- screenshotFilename
let sigma = R.readRef sigmaRef
Sigmax.dependOnSigma sigma "[cameraButton] sigma: Nothing" $ \s -> do
Sigmax.dependOnSigma (R.readRef sigmaRef) "[cameraButton] sigma: Nothing" $ \s -> do
screen <- Sigma.takeScreenshot s
let graph = Sigma.graph s
edges = Graphology.edges graph
nodes = Graphology.nodes graph
graphData = GET.GraphData $
hyperdataGraph
{ edges = A.fromFoldable $ Seq.map GEU.stEdgeToGET edges
, nodes = A.fromFoldable $ GEU.normalizeNodes $ Seq.map GEU.stNodeToGET nodes }
graphData = GET.GraphData $
graphData'
{ edges = A.fromFoldable $ Seq.map GEU.stEdgeToGET edges
, nodes = A.fromFoldable $ GEU.normalizeNodes $ Seq.map GEU.stNodeToGET nodes }
let camera = Camera.toCamera $ Camera.camera s
let hyperdataGraph' = GET.HyperdataGraph { graph: graphData, mCamera: Just camera }
launchAff_ $ do
...
...
@@ -107,6 +108,7 @@ cameraButtonCpt = here.component "cameraButton" cpt
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Right _ret -> do
liftEffect $ T2.reload reloadForest
, status: SigmaxTypes.forceAtlasComponentStatus forceAtlasState
, variant: OutlinedButtonVariant Secondary
} [ H.text "Screenshot" ]
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
ce88d2c0
...
...
@@ -184,6 +184,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
,
cameraButton
{ id: graphId'
, forceAtlasState: forceAtlasState'
, hyperdataGraph: hyperdataGraph'
, reloadForest
, session: session
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
ce88d2c0
...
...
@@ -13,6 +13,7 @@ import Data.Tuple (Tuple(..))
import Partial.Unsafe (unsafePartial)
import Prelude (class Eq, class Show, map, ($), (&&), (==), (||), (<$>), (<), mod, not)
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.GraphExplorer.GraphTypes as GEGT
import Gargantext.Data.Louvain as Louvain
import Gargantext.Types as GT
...
...
@@ -172,6 +173,15 @@ toggleForceAtlasState Running = Paused
toggleForceAtlasState Paused = Running
toggleForceAtlasState Killed = InitialRunning
forceAtlasComponentStatus :: ForceAtlasState -> ComponentStatus
forceAtlasComponentStatus InitialRunning = Disabled
forceAtlasComponentStatus InitialStopped = Enabled
forceAtlasComponentStatus Running = Disabled
forceAtlasComponentStatus Paused = Enabled
forceAtlasComponentStatus Killed = Enabled
-- | Custom state for show edges. Normally it is EShow or EHide (show/hide
-- | edges). However, edges are temporarily turned off when forceAtlas is
-- | running.
...
...
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