Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
fix: color everything on load
Browse files Browse the repository at this point in the history
  • Loading branch information
prescientmoon committed Jun 17, 2020
1 parent 54cfe3d commit 840736a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Component/Editor.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Control.MonadZero (guard)
import Data.Argonaut (Json)
import Data.Array ((!!))
import Data.Foldable (find, for_, traverse_)
import Data.Lens (over, set, view)
import Data.Lens (over, preview, set, view)
import Data.Map as Map
import Data.Maybe (Maybe(..), isNothing, maybe)
import Data.Set as Set
Expand Down Expand Up @@ -48,8 +48,9 @@ import Lunarbox.Data.Editor.Node.NodeDescriptor (onlyEditable)
import Lunarbox.Data.Editor.Node.NodeId (NodeId)
import Lunarbox.Data.Editor.Node.PinLocation (Pin(..))
import Lunarbox.Data.Editor.Save (stateToJson)
import Lunarbox.Data.Editor.State (State, Tab(..), _atGeometry, _atInputCount, _currentFunction, _currentTab, _isAdmin, _isExample, _isVisible, _name, _nodeSearchTerm, _panelIsOpen, _partialFrom, _partialTo, _unconnectablePins, compile, createNode, deleteFunction, functionExists, initializeFunction, makeUnconnetacbleList, preventDefaults, removeConnection, searchNode, setCurrentFunction, setRuntimeValue, tabIcon, tryConnecting)
import Lunarbox.Data.Editor.State (State, Tab(..), _atGeometry, _atInputCount, _currentFunction, _currentTab, _isAdmin, _isExample, _isVisible, _name, _nodeSearchTerm, _nodes, _panelIsOpen, _partialFrom, _partialTo, _unconnectablePins, compile, createNode, deleteFunction, functionExists, initializeFunction, makeUnconnetacbleList, preventDefaults, removeConnection, searchNode, setCurrentFunction, setRuntimeValue, tabIcon, tryConnecting, updateNode)
import Lunarbox.Data.Graph (wouldCreateCycle)
import Lunarbox.Data.Graph as G
import Lunarbox.Data.Route (Route(..))
import Web.Event.Event (Event, preventDefault, stopPropagation)
import Web.Event.Event as Event
Expand Down Expand Up @@ -249,7 +250,13 @@ component =
Rerender -> void $ query (SProxy :: SProxy "scene") unit $ tell $ Scene.Rerender
LoadScene -> do
gets (view _currentFunction)
>>= traverse (\name -> gets $ view $ _atGeometry name)
>>= traverse
( \name -> do
cache <- gets $ view $ _atGeometry name
(map (maybe mempty G.keys) $ gets $ preview $ _nodes name)
>>= traverse_ updateNode
pure $ cache
)
<#> join
>>= traverse_
( void
Expand Down

0 comments on commit 840736a

Please sign in to comment.