diff --git a/src/renderer/core.cljs b/src/renderer/core.cljs index 690a4a01..4faaa35e 100644 --- a/src/renderer/core.cljs +++ b/src/renderer/core.cljs @@ -90,11 +90,6 @@ (.then (js/window.api.webrefCss.listAll) #(rf/dispatch-sync [:set-webref-css (js->clj % :keywordize-keys true)]))) -(defn resize-event - [] - (rf/dispatch-sync [:window/resize [(.-innerWidth js/window) - (.-innerHeight js/window)]])) - (defn ^:export init [] #_(if platform/electron? (sentry-electron-renderer/init (clj->js config/sentry-options) sentry-react/init) @@ -121,9 +116,6 @@ (.addEventListener js/document "keydown" keyb/event-handler) (.addEventListener js/document "keyup" keyb/event-handler) - (.addEventListener js/window "load" resize-event) ; Save initial size. - (.addEventListener js/window "resize" resize-event) - (.setup paper) (if platform/electron? diff --git a/src/renderer/views.cljs b/src/renderer/views.cljs index eb8b37e4..0f34fee2 100644 --- a/src/renderer/views.cljs +++ b/src/renderer/views.cljs @@ -122,65 +122,55 @@ (defn tree-panel [] - (let [tree? @(rf/subscribe [:panel/visible? :tree]) - tree-min-width @(rf/subscribe [:window/tree-min-width])] - (when (and tree? tree-min-width) - [:<> - [:> Panel - {:id "tree-panel" - :minSize tree-min-width - :defaultSize tree-min-width - :class "flex flex-col"} - [doc/actions] - [tree/root]] - [:> PanelResizeHandle - {:id "tree-resize-handle" - :className "resize-handle"}]]))) + (when @(rf/subscribe [:panel/visible? :tree]) + [:<> + [:> Panel + {:id "tree-panel" + :class "flex flex-col" + :style {:min-width "230px"}} + [doc/actions] + [tree/root]] + [:> PanelResizeHandle + {:id "tree-resize-handle" + :className "resize-handle"}]])) (defn root [] - (let [props-min-width @(rf/subscribe [:window/props-min-width]) - props? @(rf/subscribe [:panel/visible? :properties])] - [:> Tooltip/Provider - [:div.flex.flex-col.flex-1.h-screen - [win/app-header] - (if (seq @(rf/subscribe [:documents])) - [:> PanelGroup - {:direction "horizontal" - :id "root-group" - :autoSaveId "root-group"} - [tree-panel] - [:> Panel - {:id "main-panel" - :order 2} - [:div.flex.flex-col.flex-1.overflow-hidden.h-full - [doc/tab-bar] - [:> PanelGroup - {:direction "horizontal" - :id "center-group" - :autoSaveId "center-group"} - [:> Panel - {:id "center-panel" - :minSize 10 - :order 1} - [:div.flex.h-full.flex-col - [editor]]] - - (when (and props? props-min-width) - [:<> - [:> PanelResizeHandle - {:id "properties-resize-handle" - :className "resize-handle"}] - [:> Panel - {:id "properties-panel" - :order 2 - :minSize props-min-width - :defaultSize props-min-width - :onCollapse #(rf/dispatch-sync [:panel/collapse :properties]) - :onExpand #(rf/dispatch-sync [:panel/expand :properties])} - - [attr/form]]]) - [toolbar.object/root]]]]] - [home/panel])] - [cmdk/dialog] - [notification/main]])) + [:> Tooltip/Provider + [:div.flex.flex-col.flex-1.h-screen + [win/app-header] + (if (seq @(rf/subscribe [:documents])) + [:> PanelGroup + {:direction "horizontal" + :id "root-group" + :autoSaveId "root-group"} + [tree-panel] + [:> Panel + {:id "main-panel" + :order 2} + [:div.flex.flex-col.flex-1.overflow-hidden.h-full + [doc/tab-bar] + [:> PanelGroup + {:direction "horizontal" + :id "center-group" + :autoSaveId "center-group"} + [:> Panel + {:id "center-panel" + :minSize 10 + :order 1} + [:div.flex.h-full.flex-col + [editor]]] + (when @(rf/subscribe [:panel/visible? :properties]) + [:<> + [:> PanelResizeHandle + {:id "properties-resize-handle" + :className "resize-handle"}] + [:> Panel + {:id "properties-panel" + :order 2 + :style {:min-width "320px"}} + [attr/form]]]) + [toolbar.object/root]]]]] + [home/panel])] + [cmdk/dialog] + [notification/main]]) diff --git a/src/renderer/window/db.cljs b/src/renderer/window/db.cljs index 9ea4dfe3..f72cc7e5 100644 --- a/src/renderer/window/db.cljs +++ b/src/renderer/window/db.cljs @@ -4,5 +4,4 @@ [:map [:maximized? boolean?] [:minimized? boolean?] - [:fullscreen? boolean?] - [:size [:tuple double? double?]]]) + [:fullscreen? boolean?]]) diff --git a/src/renderer/window/events.cljs b/src/renderer/window/events.cljs index 16375ad6..4635c163 100644 --- a/src/renderer/window/events.cljs +++ b/src/renderer/window/events.cljs @@ -21,12 +21,6 @@ (fn [db [_ state]] (assoc db :minimized? state))) -(rf/reg-event-db - :window/resize - (rf/path :window) - (fn [db [_ size]] - (assoc db :size size))) - (rf/reg-fx ::close (fn [_] diff --git a/src/renderer/window/subs.cljs b/src/renderer/window/subs.cljs index 27391125..e097664d 100644 --- a/src/renderer/window/subs.cljs +++ b/src/renderer/window/subs.cljs @@ -15,22 +15,3 @@ :window/fullscreen? :<- [:window] :-> :fullscreen?) - -(rf/reg-sub - :window/size - :<- [:window] - :-> :size) - -(rf/reg-sub - :window/tree-min-width - :<- [:window/size] - (fn [size] - (when-let [width (first size)] - (* (/ 230 width) 100)))) - -(rf/reg-sub - :window/props-min-width - :<- [:window/size] - (fn [size] - (when-let [width (first size)] - (* (/ 320 width) 100))))