Skip to content

Commit 27ae4e1

Browse files
committed
feat(panel): limit resizable to max 100% width and support resizable floating panels
1 parent 81d2757 commit 27ae4e1

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/core/components/panel/panel.less

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ html {
258258
.with-panel-right-floating .panel-right {
259259
transform: translate3d(-8px, 0, 0);
260260
}
261+
.panel-resizable {
262+
max-width: 100%;
263+
}
261264
.panel-resize-handler {
262265
position: absolute;
263266
top: 0;
@@ -269,14 +272,16 @@ html {
269272
.panel-resizable & {
270273
display: block;
271274
}
272-
.panel-left.panel-cover & {
275+
.panel-left.panel-cover &,
276+
.panel-left.panel-floating & {
273277
right: -3px;
274278
}
275279
.panel-left.panel-reveal,
276280
.panel-left.panel-push & {
277281
right: 0;
278282
}
279-
.panel-right.panel-cover & {
283+
.panel-right.panel-cover &,
284+
.panel-right.panel-floating & {
280285
left: -3px;
281286
}
282287
.panel-right.panel-reveal,

src/core/components/panel/resizable-panel.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function resizablePanel(panel) {
2727
let panelMaxWidth;
2828
let visibleByBreakpoint;
2929

30+
const isPushingPanel = effect !== 'cover' && effect !== 'floating';
31+
3032
function transformCSSWidth(v) {
3133
if (!v) return null;
3234
if (v.indexOf('%') >= 0 || v.indexOf('vw') >= 0) {
@@ -60,13 +62,13 @@ function resizablePanel(panel) {
6062
$el.transition(0);
6163
$el.addClass('panel-resizing');
6264
$htmlEl.css('cursor', 'col-resize');
63-
if (effect !== 'cover' || visibleByBreakpoint) {
65+
if (isPushingPanel || visibleByBreakpoint) {
6466
$viewEl = $(panel.getViewEl());
6567
if (panel.$containerEl && panel.$containerEl.hasClass('page')) {
6668
$viewEl.add(panel.$containerEl.children('.page-content, .tabs, .fab'));
6769
}
6870
}
69-
if (effect !== 'cover' && !visibleByBreakpoint) {
71+
if (isPushingPanel && !visibleByBreakpoint) {
7072
$backdropEl.transition(0);
7173
$viewEl.transition(0);
7274
}
@@ -89,7 +91,7 @@ function resizablePanel(panel) {
8991

9092
panel.resizableWidth = newPanelWidth;
9193
$el[0].style.width = `${newPanelWidth}px`;
92-
if (effect !== 'cover' && !visibleByBreakpoint) {
94+
if (isPushingPanel && !visibleByBreakpoint) {
9395
if ($viewEl) {
9496
$viewEl.transform(
9597
`translate3d(${side === 'left' ? newPanelWidth : -newPanelWidth}px, 0, 0)`,
@@ -119,14 +121,14 @@ function resizablePanel(panel) {
119121

120122
$htmlEl[0].style.setProperty(`--f7-panel-${side}-width`, `${panel.resizableWidth}px`);
121123
$el[0].style.width = '';
122-
if (effect !== 'cover' && !visibleByBreakpoint) {
124+
if (isPushingPanel && !visibleByBreakpoint) {
123125
$viewEl.transform('');
124126
$backdropEl.transform('');
125127
}
126128
$el.removeClass('panel-resizing');
127129
nextFrame(() => {
128130
$el.transition('');
129-
if (effect !== 'cover') {
131+
if (isPushingPanel) {
130132
$backdropEl.transition('');
131133
if ($viewEl) $viewEl.transition('');
132134
}

0 commit comments

Comments
 (0)