|
126 | 126 |
|
127 | 127 | // Setup splitter |
128 | 128 | if (document.getElementsByClassName("split-pane").length) { |
| 129 | + var orientation = Espruino.Config.UI_VERTICAL ? "horizontal" : "vertical"; |
| 130 | + |
129 | 131 | $(".split-pane").splitster({ |
130 | | - orientation: "vertical", //TODO: Load from local storage, |
| 132 | + orientation: orientation, |
131 | 133 | barWidth: 0, // Don't show the bar when vertical, |
132 | 134 | draggable: ".editor--code > .sidebar" |
133 | 135 | }); |
134 | | - |
| 136 | + function updateSplitter() { |
| 137 | + $(".split-pane").splitster("orientation", orientation); |
| 138 | + $(".split-pane").splitster("barWidth", orientation == "vertical" ? 0 : 10); |
| 139 | + $(".split-pane").splitster("draggable", orientation == "vertical" ? ".editor--code > .sidebar" : false); |
| 140 | + } |
| 141 | + updateSplitter(); |
135 | 142 | // Setup orientation button |
136 | | - var orientation = "vertical"; |
137 | 143 | var orientationBtn = Espruino.Core.App.addIcon({ |
138 | 144 | id: "orientation", |
139 | 145 | icon: "split-" + orientation, |
|
146 | 152 | }, |
147 | 153 | click: function() { |
148 | 154 | orientation = orientation == "vertical" ? "horizontal" : "vertical"; |
149 | | - $(".split-pane").splitster("orientation", orientation); |
150 | | - $(".split-pane").splitster("barWidth", orientation == "vertical" ? 0 : 10); |
151 | | - $(".split-pane").splitster("draggable", orientation == "vertical" ? ".editor--code > .sidebar" : false); |
| 155 | + Espruino.Config.set("UI_VERTICAL", orientation == "horizontal"); // splitter=horiz means vertical layout |
| 156 | + updateSplitter(); |
152 | 157 | orientationBtn.setIcon("split-" + orientation); |
153 | 158 | } |
154 | 159 | }); |
|
0 commit comments