Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c9f5c02
Added draft for min-max control context menu
demvlad May 15, 2026
65491dd
Added missing emitUpdate() call
demvlad May 16, 2026
28a16a4
Added checking for field.curve.MinMax fields
demvlad May 16, 2026
565ed54
Code style improvement
demvlad May 16, 2026
8e5cb80
Removed yarn.lock
demvlad May 16, 2026
eb17832
Created menu architecture. Improved data struct field checking
demvlad May 16, 2026
d9df809
Resolved missing comma
demvlad May 16, 2026
f0df8f8
The One scale minmax menu action set uncentered scale
demvlad May 16, 2026
1254235
Added proper label for selected curves submenu
demvlad May 16, 2026
396f9de
Added action for Full range minmax control menu
demvlad May 17, 2026
ff91fc4
Added handler for the selected field submenu 'Full range' item
demvlad May 18, 2026
f1002dc
Added handler for the selected field submenu 'Centered' item
demvlad May 18, 2026
6c3789b
Added handler for the selected field submenu 'Default' item
demvlad May 18, 2026
dcc7f46
Added arrow symbol into submenu label
demvlad May 18, 2026
c7bbf69
Added Zoom actions for minmax control menu
demvlad May 18, 2026
8073761
Using special portal container for the minmax control context menu
demvlad May 18, 2026
f91489a
Added guard for minmax values input
demvlad May 18, 2026
7b25f04
The one emit is used for all the zoomed curves
demvlad May 18, 2026
d498935
The minmax control menu does not close after zoom action
demvlad May 19, 2026
13d891b
The currentState and menuItems are reference now
demvlad May 20, 2026
de0b0ae
Code style improvement
demvlad May 20, 2026
ae1dd76
The one context menu is used for the both minmax input fields
demvlad May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 158 additions & 33 deletions src/components/GraphConfigDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<UModal v-model:open="open" :ui="{ content: 'sm:max-w-fit' }">
<UModal v-model:open="open" :ui="{ content: 'sm:max-w-fit' }" class="overflow-visible">
<template #header>
<div class="flex items-center justify-between w-full">
<h4 class="font-semibold">Configure graphs</h4>
Expand Down Expand Up @@ -28,6 +28,7 @@
/>
</div>
</div>
<div id="menu-portal-container"></div>
</template>

<template #body>
Expand Down Expand Up @@ -159,38 +160,44 @@
@click="cycleColor(field)"
/>
</div>
<UInputNumber
:model-value="field.curve?.MinMax?.min ?? -500"
:step="10"
:format-options="noGrouping"
size="xs"
orientation="vertical"
:ui="{ root: 'w-20' }"
@update:model-value="
setMin(field, $event);
emitUpdate();
"
@dblclick="
resetMin(field);
emitUpdate();
"
/>
<UInputNumber
:model-value="field.curve?.MinMax?.max ?? 500"
:step="10"
:format-options="noGrouping"
size="xs"
orientation="vertical"
:ui="{ root: 'w-20' }"
@update:model-value="
setMax(field, $event);
emitUpdate();
"
@dblclick="
resetMax(field);
emitUpdate();
"
/>
<UContextMenu :items="menuItems" :portal="false" :ui="{content: 'z-[9999] relative'}">
<UInputNumber
:model-value="field.curve?.MinMax?.min ?? -500"
:step="10"
:format-options="noGrouping"
size="xs"
orientation="vertical"
:ui="{ root: 'w-20' }"
@update:model-value="
setMin(field, $event);
emitUpdate();
"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
@dblclick="
resetMin(field);
emitUpdate();
"
@contextmenu="(e) => onContextMenu(e, graph, field)"
/>
</UContextMenu>
<UContextMenu :items="menuItems" :portal="false" :ui="{content: 'z-[9999] relative'}">
<UInputNumber
:model-value="field.curve?.MinMax?.max ?? 500"
:step="10"
:format-options="noGrouping"
size="xs"
orientation="vertical"
:ui="{ root: 'w-20' }"
@update:model-value="
setMax(field, $event);
emitUpdate();
"
@dblclick="
resetMax(field);
emitUpdate();
"
@contextmenu="(e) => onContextMenu(e, graph, field)"
/>
</UContextMenu>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
<UButton
variant="ghost"
color="error"
Expand Down Expand Up @@ -597,4 +604,122 @@ watch(open, (val) => {
prevConfig.value = convertToConfig();
}
});

const currentState = {
graph: null,
field: null,
};

function onContextMenu(event, graph, field) {
currentState.graph = graph;
currentState.field = field;
}

function setMinMaxToDefault() {
if (currentState.graph) {
for (const field of currentState.graph.fields) {
resetMin(field);
resetMax(field);
}
emitUpdate();
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

function setMinMaxLikeThis() {
if (currentState.graph && currentState.field) {
const min = currentState.field.curve?.MinMax?.min;
const max = currentState.field.curve?.MinMax?.max;
for (const field of currentState.graph.fields) {
setMin(field, min);
setMax(field, max);
}
emitUpdate();
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

function setMinMaxCentered() {
if (currentState.graph) {
for (const field of currentState.graph.fields) {
let min = field.curve?.MinMax?.min;
let max = field.curve?.MinMax?.max;
max = Math.max(Math.abs(min), Math.abs(max));
min = -max;
setMin(field, min);
setMax(field, max);
}
emitUpdate();
}
}

function setMinMaxOneScale() {
let max = -Number.MAX_VALUE;
let min;
if (currentState.graph) {
for (const field of currentState.graph.fields) {
max = Math.max(max, Math.max(Math.abs(field.curve?.MinMax?.min), Math.abs(field.curve?.MinMax?.max)));
}
min = -max;

for (const field of currentState.graph.fields) {
setMin(field, min);
setMax(field, max);
}
emitUpdate();
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const menuItems = [
{
label: 'Like this one',
onSelect() {
setMinMaxLikeThis();
},
},
{
label: 'Full range',
disabled: true,
},
{
label: 'One scale',
onSelect() {
setMinMaxOneScale();
},
},
{
label: 'Centered',
onSelect() {
setMinMaxCentered();
},
},
{
type: 'separator',
},
{
label: 'Zoom In',
disabled: true,
},
{
label: 'Zoom Out',
disabled: true,
},
{
type: 'separator',
},
{
label: 'Default',
onSelect() {
setMinMaxToDefault();
},
},
{
type: 'separator',
},
{
type: 'separator',
},
{
label: '\u25BCClose',
},
];

</script>
Loading
Loading