Skip to content

Commit

Permalink
Allow maximising the bracket modal and put zoom buttons in the centre…
Browse files Browse the repository at this point in the history
… of the modal header
  • Loading branch information
phrasmotica committed Apr 27, 2024
1 parent f12709d commit 657098a
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/components/modals/BracketModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ watch(currentLevel, () => {
const panzoom = ref<PanzoomObject>()
const show = () => {
fixButtonsWidth()
createPanzoom()
}
const fixButtonsWidth = () => {
// ensures the zoom buttons are in the actual centre of the modal header
const zoomButtons = document.getElementById('zoomButtons')
if (!zoomButtons) {
return
}
const modalButtons = <HTMLElement>document.getElementsByClassName('p-dialog-header-icons')[0]
const newMargin = modalButtons?.offsetWidth || 0
zoomButtons.style.marginLeft = `${newMargin}px`
}
const createPanzoom = () => {
const orgChartTable = document
.getElementById('bracketDiv')
Expand All @@ -58,12 +77,15 @@ const createPanzoom = () => {
<template>
<Dialog
modal
class="bracket-modal mx-4"
maximizable
class="bracket-modal"
v-model:visible="visible"
:header="t('bracket.knockoutBracket')"
@show="createPanzoom">
@show="show">
<template #header>
<div class="flex-grow-1 flex gap-2 mr-2">
<div
id="zoomButtons"
class="flex justify-content-center flex-grow-1 gap-2">
<Button
class="w-5rem"
icon="pi pi-search-minus"
Expand Down Expand Up @@ -93,6 +115,10 @@ const createPanzoom = () => {
max-width: 90vw;
}
.bracket-modal.p-dialog-maximized {
max-width: 100vw;
}
.grab {
cursor: grab!important;
}
Expand Down

0 comments on commit 657098a

Please sign in to comment.