Skip to content
Merged
Changes from 1 commit
Commits
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
41 changes: 39 additions & 2 deletions src/components/GraphConfigDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@
<div style="display: contents;" @contextmenu="(e) => onContextMenu(e, graph, field)">
<UInputNumber
:model-value="field.curve?.MinMax?.min ?? -500"
:step="10"
:step="field.curve?.highPrecise ? smallMinMaxStep : normalMinMaxStep"
:class="{ 'italic': field.curve?.highPrecise }"
:format-options="noGrouping"
size="xs"
orientation="vertical"
Expand All @@ -177,10 +178,17 @@
resetMin(field);
emitUpdate();
"
@keydown="(e) => {
if (e.ctrlKey && field.curve) {
e.preventDefault();
field.curve.highPrecise = !field.curve.highPrecise;
}
}"
Comment thread
demvlad marked this conversation as resolved.
/>
<UInputNumber
:model-value="field.curve?.MinMax?.max ?? 500"
:step="10"
:step="field.curve?.highPrecise ? smallMinMaxStep : normalMinMaxStep"
:class="{ 'italic': field.curve?.highPrecise }"
:format-options="noGrouping"
size="xs"
orientation="vertical"
Expand All @@ -193,6 +201,12 @@
resetMax(field);
emitUpdate();
"
@keydown="(e) => {
if (e.ctrlKey && field.curve) {
e.preventDefault();
field.curve.highPrecise = !field.curve.highPrecise;
}
}"
/>
</div>
</UContextMenu>
Expand Down Expand Up @@ -607,9 +621,32 @@ watch(open, (val) => {
if (props.graphConfig) {
localGraphs.value = props.graphConfig.getGraphs().map(cloneGraphToLocal);
prevConfig.value = convertToConfig();
defineFieldsResolution();
}
});

// Set curves min-max values changes step. Switch between normal 10 or precesion 0.1 step by using Ctrl key.
// The precesion value input has italic font.

const normalMinMaxStep = 10;
const smallMinMaxStep = 0.1;

function defineFieldsResolution() {
for (const graph of localGraphs.value) {
for (const field of graph.fields) {
const min = field?.curve?.MinMax?.min;
const max = field?.curve?.MinMax?.max;
if (min && max) {
field.curve.highPrecise = min % normalMinMaxStep !== 0 || max % normalMinMaxStep !== 0;
}
Comment thread
demvlad marked this conversation as resolved.
}
}
}

// Context menu to manage curves min-max values
// Right mouse click at min-max input to show simple menu
// Shift + right mouse click to show extended menu

const currentState = ref({
graph: null,
field: null,
Expand Down
Loading