Skip to content

Commit 5f3a4fb

Browse files
committed
fix: 修复浮动窗口最大化后取消浮动,窗口大小记录错误
1 parent b0ec822 commit 5f3a4fb

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

src/components/BootstrapBlazor.DockView/wwwroot/css/dockview-bb.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@
222222
justify-content: flex-start;
223223
flex-direction: column;
224224
}
225+
.bb-dockview .bb-dockview-aside:empty {
226+
width: 0;
227+
}
225228

226229
.bb-dockview .bb-dockview-aside-left {
227230
left: 0;

src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-group.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,6 @@ const toggleFull = (group, actionContainer, maximize) => {
515515

516516
const float = group => {
517517
if (!canFloat(group)) return;
518-
if (group.api.isMaximized()) {
519-
toggleFull(group, group.header.rightActionsContainer, true);
520-
}
521518
const dockview = group.api.accessor
522519
const width = dockview.width > 500 ? 500 : (dockview.width - 10)
523520
const height = dockview.height > 460 ? 460 : (dockview.height - 10)
@@ -612,18 +609,21 @@ const dock = (group, floatType) => {
612609
const originGroup = dockview.groups.find(g => g.id.split('_')[0] == group.id.split('_')[0] && g.id != group.id)
613610
if (!originGroup) return
614611
dockview.setVisible(originGroup, true)
615-
const { drawer } = group.getParams()
612+
originGroup.header.rightActionsContainer.classList.remove('bb-maximize')
613+
originGroup.element.parentElement.classList.remove('bb-maximize')
614+
const { drawer, rect = {} } = group.getParams()
616615
const inset = group.element.parentElement.style.inset.split(' ').map(item => isNaN(parseFloat(item)) ? item : parseFloat(item))
617-
const rect = {
618-
width: group.width + 2,
619-
height: group.height + 2,
620-
position: {}
621-
}
616+
if(rect.isMaximized === false) {
617+
rect.width = group.width + 2;
618+
rect.height = group.height + 2;
619+
rect.position = {};
622620
;['top', 'right', 'bottom', 'left'].forEach((key, index) => {
623621
if (typeof inset[index] == 'number') {
624622
rect.position[key] = inset[index]
625623
}
626624
})
625+
}
626+
rect.isMaximized = false
627627
if (floatType == 'drawer') {
628628
group.setParams({ drawer: { ...drawer, width: rect.width } })
629629
group.removePropsOfParams('floatType')
@@ -681,13 +681,14 @@ const floatingMaximize = group => {
681681
const rect = {
682682
width: group.width + 2,
683683
height: group.height + 2,
684+
isMaximized: true,
684685
position: {}
685686
}
686-
;['top', 'right', 'bottom', 'left'].forEach((key, index) => {
687-
if (typeof inset[index] == 'number') {
688-
rect.position[key] = inset[index]
689-
}
690-
})
687+
;['top', 'right', 'bottom', 'left'].forEach((key, index) => {
688+
if (typeof inset[index] == 'number') {
689+
rect.position[key] = inset[index]
690+
}
691+
})
691692
group.setParams({ rect })
692693

693694
parentEle.style.left = 0;
@@ -705,6 +706,7 @@ const floatingExitMaximized = group => {
705706
.map(item => typeof item == 'number' ? (item + 'px') : 'auto').join(' ')
706707
parentEle.style.width = `${rect.width}px`;
707708
parentEle.style.height = `${rect.height}px`;
709+
group.setParams({ rect: { ...rect, isMaximized: false } })
708710
}
709711

710712
const setWidth = (observerList) => {

0 commit comments

Comments
 (0)