Skip to content

Commit b9f44ab

Browse files
committed
feat(layout): optimize panel resize handles for mobile touch devices
1 parent 959e30b commit b9f44ab

2 files changed

Lines changed: 70 additions & 7 deletions

File tree

anycode-base/src/styles.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,3 +526,9 @@
526526
background-color: rgba(173, 214, 255, 0.18);
527527
border-radius: 2px;
528528
}
529+
530+
@media (pointer: coarse) {
531+
.anyeditor .code {
532+
font-size: 16px;
533+
}
534+
}

anycode/components/layout/Layout.css

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,32 +458,89 @@
458458
min-width: 0;
459459
}
460460

461-
.app-layout-split .dv-sash {
462-
background-color: transparent;
461+
.layout,
462+
.dock-split {
463+
/* Asymmetrical hit margins to prevent blocking clicks on the left side (e.g. file tree) */
464+
--sash-hit-margin-left: 2px;
465+
--sash-hit-margin-right: 2px;
466+
}
467+
468+
@media (pointer: coarse) {
469+
.layout,
470+
.dock-split {
471+
--sash-hit-margin-left: 4px; /* Made smaller on the left to avoid blocking file explorer clicks */
472+
--sash-hit-margin-right: 4px; /* Larger on the right side where it is safer to tap */
473+
}
463474
}
464475

465-
.app-layout-split .dv-sash::after {
476+
.layout .dv-sash,
477+
.dock-split .dv-sash {
478+
background-color: transparent !important;
479+
}
480+
481+
.layout .dv-sash::after,
482+
.dock-split .dv-sash::after {
466483
content: '';
467484
position: absolute;
468485
pointer-events: none;
486+
transition: background-color 0.15s ease;
469487
}
470488

471-
.app-layout-split .dv-vertical > .dv-sash-container > .dv-sash::after {
489+
/* Vertical sashes (separating panels horizontally) */
490+
.layout .dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash::after,
491+
.dock-split .dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash::after {
472492
left: 50%;
473493
top: 0;
474494
bottom: 0;
475495
width: 2px;
476496
transform: translateX(-50%);
477-
background: linear-gradient(to bottom, transparent, #555, transparent);
497+
background: linear-gradient(to bottom, transparent, var(--theme-border, #555), transparent);
478498
}
479499

480-
.app-layout-split .dv-horizontal > .dv-sash-container > .dv-sash::after {
500+
/* Horizontal sashes (separating panels vertically) */
501+
.layout .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash::after,
502+
.dock-split .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash::after {
481503
left: 0;
482504
right: 0;
483505
top: 50%;
484506
height: 2px;
485507
transform: translateY(-50%);
486-
background: linear-gradient(to right, transparent, #555, transparent);
508+
background: linear-gradient(to right, transparent, var(--theme-border, #555), transparent);
509+
}
510+
511+
/* Highlight active/dragging sashes */
512+
.layout .dv-sash:not(.disabled):active::after,
513+
.dock-split .dv-sash:not(.disabled):active::after,
514+
.layout .dv-sash:not(.disabled):hover::after,
515+
.dock-split .dv-sash:not(.disabled):hover::after {
516+
background: var(--theme-accent-background, #007acc) !important;
517+
}
518+
519+
/* Expanded hit area for sashes to make resizing easier, especially on touch devices */
520+
.layout .dv-sash::before,
521+
.dock-split .dv-sash::before {
522+
content: '';
523+
position: absolute;
524+
z-index: 10;
525+
background: transparent;
526+
}
527+
528+
/* Vertical sashes hit area (separating panels horizontally) */
529+
.layout .dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash::before,
530+
.dock-split .dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash::before {
531+
top: 0;
532+
bottom: 0;
533+
left: calc(-1 * var(--sash-hit-margin-left));
534+
right: calc(-1 * var(--sash-hit-margin-right));
535+
}
536+
537+
/* Horizontal sashes hit area (separating panels vertically) */
538+
.layout .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash::before,
539+
.dock-split .dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash::before {
540+
left: 0;
541+
right: 0;
542+
top: calc(-1 * var(--sash-hit-margin-left));
543+
bottom: calc(-1 * var(--sash-hit-margin-right));
487544
}
488545

489546
.layout .dv-tab-overflow-control,

0 commit comments

Comments
 (0)