@@ -247,6 +247,7 @@ const open = defineModel("open", { type: Boolean, default: false });
247247const props = defineProps ({
248248 flightLog: { type: Object , default: null },
249249 graphConfig: { type: Object , default: null },
250+ grapher: { type: Object , default: null },
250251});
251252
252253const 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+
754785function 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