Skip to content

Commit 6980cd2

Browse files
committed
Added action for setup MinMax values for the window and selected marker interval
1 parent 7db8e66 commit 6980cd2

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
v-model:open="appStore.graphConfigDialogOpen"
101101
:flightLog="logStore.flightLog"
102102
:graphConfig="graphStore.activeGraphConfig"
103+
:grapher="graphStore.graph",
103104
@save="onGraphConfigSave"
104105
@update="onGraphConfigUpdate"
105106
/>

src/components/GraphConfigDialog.vue

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ const open = defineModel("open", { type: Boolean, default: false });
247247
const props = defineProps({
248248
flightLog: { type: Object, default: null },
249249
graphConfig: { type: Object, default: null },
250+
grapher: { type: Object, default: null },
250251
});
251252
252253
const emit = defineEmits(["save", "update"]);
@@ -751,6 +752,36 @@ function setMinMaxToFullRangeDuringAllTime(setCheckedOnly) {
751752
}
752753
}
753754
755+
function getMinMaxForFieldDuringWindowTimeInterval(setCheckedOnly) {
756+
if (currentState.value.graph?.fields && props.flightLog && props.grapher) {
757+
for (const [index, field] of currentState.value.graph.fields.entries()) {
758+
if ((!setCheckedOnly || !currentState.value.isFieldChecked) || currentState.value.isFieldChecked[index]) {
759+
const mm = GraphConfig.getMinMaxForFieldDuringWindowTimeInterval(props.flightLog, props.grapher, field.name);
760+
if (mm?.min !== undefined && mm?.max !== undefined) {
761+
setMin(field, mm.min);
762+
setMax(field, mm.max);
763+
}
764+
}
765+
}
766+
emitUpdate();
767+
}
768+
}
769+
770+
function getMinMaxForFieldDuringMarkedInterval(setCheckedOnly) {
771+
if (currentState.value.graph?.fields && props.flightLog && props.grapher) {
772+
for (const [index, field] of currentState.value.graph.fields.entries()) {
773+
if ((!setCheckedOnly || !currentState.value.isFieldChecked) || currentState.value.isFieldChecked[index]) {
774+
const mm = GraphConfig.getMinMaxForFieldDuringMarkedInterval(props.flightLog, props.grapher, field.name);
775+
if (mm?.min !== undefined && mm?.max !== undefined) {
776+
setMin(field, mm.min);
777+
setMax(field, mm.max);
778+
}
779+
}
780+
}
781+
emitUpdate();
782+
}
783+
}
784+
754785
function setMinMaxSelectedToFullRangeDuringAllTime() {
755786
if (currentState.value.field?.name && props.flightLog) {
756787
const mm = props.flightLog.getMinMaxForFieldDuringAllTime(currentState.value.field?.name);
@@ -934,15 +965,15 @@ const extendedMenuItems = computed(() => [
934965
},
935966
{
936967
label: "At the window time",
937-
disabled: true,
938968
onSelect(e) {
969+
getMinMaxForFieldDuringWindowTimeInterval(true);
939970
e.preventDefault();
940971
},
941972
},
942973
{
943974
label: "At the markers time",
944-
disabled: true,
945975
onSelect(e) {
976+
getMinMaxForFieldDuringMarkedInterval(true);
946977
e.preventDefault();
947978
},
948979
},

0 commit comments

Comments
 (0)