Skip to content

Commit ce8c2d0

Browse files
committed
Initial resize fixes
1 parent abae501 commit ce8c2d0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

js/layout.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function showSerial() {
5959

6060
// update type is used to indicate which button was clicked
6161
function updatePageLayout(updateType) {
62+
// If both are visible, show the separator
6263
if (isEditorVisible() && isSerialVisible()) {
6364
pageSeparator.classList.add('active');
6465
} else {
@@ -72,6 +73,7 @@ function updatePageLayout(updateType) {
7273

7374
// Mobile layout, so only show one or the other
7475
if (mainContent.offsetWidth < 768) {
76+
// Prioritize based on the update type
7577
if (updateType == UPDATE_TYPE_EDITOR && isEditorVisible()) {
7678
serialPage.classList.remove('active');
7779
} else if (updateType == UPDATE_TYPE_SERIAL && isSerialVisible()) {
@@ -130,8 +132,7 @@ function fixViewportHeight(e) {
130132
}
131133

132134
// Resize the panes when the separator is moved
133-
function resize(e) {
134-
console.log("Resized");
135+
function resizePanels(e) {
135136
const w = mainContent.offsetWidth;
136137
const gap = pageSeparator.offsetWidth;
137138
const ratio = e.clientX / w;
@@ -182,12 +183,12 @@ function loadPanelSettings() {
182183
}
183184

184185
function stopResize(e) {
185-
window.removeEventListener('mousemove', resize, false);
186+
window.removeEventListener('mousemove', resizePanels, false);
186187
window.removeEventListener('mouseup', stopResize, false);
187188
}
188189

189190
pageSeparator.addEventListener('mousedown', async function (e) {
190-
window.addEventListener('mousemove', resize, false);
191+
window.addEventListener('mousemove', resizePanels, false);
191192
window.addEventListener('mouseup', stopResize, false);
192193
});
193194

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)