Add slide on side bar in Studio mode
This commit is contained in:
parent
5a8b290758
commit
d28dfd6d81
2 changed files with 109 additions and 6 deletions
6
document-parser/package-lock.json
generated
Normal file
6
document-parser/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "document-parser",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
|
|
@ -132,8 +132,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Resize handle -->
|
||||||
|
<div
|
||||||
|
class="resize-handle"
|
||||||
|
@mousedown="onResizeStart"
|
||||||
|
>
|
||||||
|
<div class="resize-grip" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Right: Config or Results panel -->
|
<!-- Right: Config or Results panel -->
|
||||||
<div class="right-panel">
|
<div class="right-panel" :style="{ width: rightPanelWidth + 'px' }">
|
||||||
<!-- CONFIGURER MODE -->
|
<!-- CONFIGURER MODE -->
|
||||||
<div v-if="mode === 'configurer'" class="config-panel">
|
<div v-if="mode === 'configurer'" class="config-panel">
|
||||||
<div class="config-section">
|
<div class="config-section">
|
||||||
|
|
@ -290,6 +298,38 @@ const visualMode = ref(false)
|
||||||
const pdfImageRef = ref(null)
|
const pdfImageRef = ref(null)
|
||||||
const bboxOverlayRef = ref(null)
|
const bboxOverlayRef = ref(null)
|
||||||
|
|
||||||
|
// --- Resizable right panel ---
|
||||||
|
const RIGHT_PANEL_MIN = 280
|
||||||
|
const RIGHT_PANEL_MAX_RATIO = 0.7
|
||||||
|
const rightPanelWidth = ref(380)
|
||||||
|
let resizing = false
|
||||||
|
|
||||||
|
function onResizeStart(e) {
|
||||||
|
e.preventDefault()
|
||||||
|
resizing = true
|
||||||
|
document.body.style.cursor = 'col-resize'
|
||||||
|
document.body.style.userSelect = 'none'
|
||||||
|
document.addEventListener('mousemove', onResizeMove)
|
||||||
|
document.addEventListener('mouseup', onResizeEnd)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onResizeMove(e) {
|
||||||
|
if (!resizing) return
|
||||||
|
const maxWidth = window.innerWidth * RIGHT_PANEL_MAX_RATIO
|
||||||
|
const newWidth = window.innerWidth - e.clientX
|
||||||
|
rightPanelWidth.value = Math.max(RIGHT_PANEL_MIN, Math.min(newWidth, maxWidth))
|
||||||
|
}
|
||||||
|
|
||||||
|
function onResizeEnd() {
|
||||||
|
resizing = false
|
||||||
|
document.body.style.cursor = ''
|
||||||
|
document.body.style.userSelect = ''
|
||||||
|
document.removeEventListener('mousemove', onResizeMove)
|
||||||
|
document.removeEventListener('mouseup', onResizeEnd)
|
||||||
|
// Redraw bbox overlay after resize
|
||||||
|
nextTick(() => bboxOverlayRef.value?.draw())
|
||||||
|
}
|
||||||
|
|
||||||
const pipelineOptions = reactive({
|
const pipelineOptions = reactive({
|
||||||
do_ocr: true,
|
do_ocr: true,
|
||||||
do_table_structure: true,
|
do_table_structure: true,
|
||||||
|
|
@ -371,6 +411,8 @@ onMounted(async () => {
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
analysisStore.stopPolling()
|
analysisStore.stopPolling()
|
||||||
|
document.removeEventListener('mousemove', onResizeMove)
|
||||||
|
document.removeEventListener('mouseup', onResizeEnd)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -640,19 +682,70 @@ onBeforeUnmount(() => {
|
||||||
/* Main content */
|
/* Main content */
|
||||||
.studio-main {
|
.studio-main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 1fr 380px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PDF Viewer */
|
/* PDF Viewer fills remaining space */
|
||||||
.pdf-viewer-panel {
|
.pdf-viewer-panel {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 200px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-right: 1px solid var(--border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Resize handle */
|
||||||
|
.resize-handle {
|
||||||
|
width: 6px;
|
||||||
|
cursor: col-resize;
|
||||||
|
background: transparent;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
position: relative;
|
||||||
|
z-index: 5;
|
||||||
|
transition: background var(--transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 2px;
|
||||||
|
width: 1px;
|
||||||
|
background: var(--border);
|
||||||
|
transition: background var(--transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle:hover::before,
|
||||||
|
.resize-handle:active::before {
|
||||||
|
background: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle:hover,
|
||||||
|
.resize-handle:active {
|
||||||
|
background: var(--accent-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-grip {
|
||||||
|
width: 3px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--border-light);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity var(--transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle:hover .resize-grip {
|
||||||
|
opacity: 1;
|
||||||
|
background: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PDF Viewer — flex: 1 set above in .studio-main context */
|
||||||
|
|
||||||
.pdf-nav-bar {
|
.pdf-nav-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -779,12 +872,16 @@ onBeforeUnmount(() => {
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Right panel */
|
/* Right panel — width set via inline style */
|
||||||
.right-panel {
|
.right-panel {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-width: 280px;
|
||||||
|
max-width: 70vw;
|
||||||
|
border-left: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Config panel */
|
/* Config panel */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue