From 89446558fc0b35e1e7fd5d3b65628b789f6ef29d Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 24 Jun 2020 16:35:37 +0300 Subject: [PATCH] fix: canvas is no longer squised when a panel is opened --- src/Component/Editor.purs | 5 ++++- src/Component/Editor/Scene.purs | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Component/Editor.purs b/src/Component/Editor.purs index b207e8f..96bb86e 100644 --- a/src/Component/Editor.purs +++ b/src/Component/Editor.purs @@ -185,7 +185,9 @@ component = CreateNode name -> do createNode name handleAction Rerender - TogglePanel -> modify_ $ over _panelIsOpen not + TogglePanel -> do + modify_ $ over _panelIsOpen not + void $ query (SProxy :: _ "scene") unit $ tell Scene.HandleResize ChangeTab newTab -> do oldTab <- gets $ view _currentTab panelWasOpen <- gets $ view _panelIsOpen @@ -193,6 +195,7 @@ component = handleAction TogglePanel else do modify_ $ set _currentTab newTab <<< set _panelIsOpen true + void $ query (SProxy :: _ "scene") unit $ tell Scene.HandleResize CreateFunction name -> do modify_ $ initializeFunction name SelectFunction name -> do diff --git a/src/Component/Editor/Scene.purs b/src/Component/Editor/Scene.purs index 4eeee5b..6064c12 100644 --- a/src/Component/Editor/Scene.purs +++ b/src/Component/Editor/Scene.purs @@ -42,6 +42,7 @@ type Input data Query a = LoadScene GeometryCache a + | HandleResize a | Rerender a data Output @@ -117,6 +118,9 @@ component = Rerender a -> do handleAction Render pure $ Just a + HandleResize a -> do + handleAction ResizeCanvas + pure $ Just a -- This only renders the canvas, the rest of the rendering is done via some typescript code render =