1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

perf: improved resize of text editor resizing console height

This commit is contained in:
2022-07-17 12:36:37 +02:00
parent 6a6f43a718
commit 3f9e6d85ca
19 changed files with 197 additions and 35 deletions

View File

@ -126,8 +126,10 @@
<script setup lang="ts">
import { Component, computed, onMounted, onUnmounted, onUpdated, Prop, ref, Ref, watch } from 'vue';
import { storeToRefs } from 'pinia';
import { useI18n } from 'vue-i18n';
import { useWorkspacesStore } from '@/stores/workspaces';
import { useConsoleStore } from '@/stores/console';
import * as Draggable from 'vuedraggable';
import TableRow from '@/components/WorkspaceTabPropsTableRow.vue';
import TableContext from '@/components/WorkspaceTabPropsTableContext.vue';
@ -150,9 +152,12 @@ const props = defineProps({
const emit = defineEmits(['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field']);
const workspacesStore = useWorkspacesStore();
const consoleStore = useConsoleStore();
const { getWorkspace } = workspacesStore;
const { consoleHeight } = storeToRefs(consoleStore);
const tableWrapper: Ref<HTMLDivElement> = ref(null);
const propTable: Ref<HTMLDivElement> = ref(null);
const resultTable: Ref<Component> = ref(null);
@ -172,8 +177,13 @@ const resizeResults = () => {
const el = tableWrapper.value;
if (el) {
let sizeToSubtract = 0;
const footer = document.getElementById('footer');
const size = window.innerHeight - el.getBoundingClientRect().top - footer.offsetHeight;
if (footer) sizeToSubtract += footer.offsetHeight;
sizeToSubtract += consoleHeight.value;
const size = window.innerHeight - el.getBoundingClientRect().top - sizeToSubtract;
resultsSize.value = size;
}
}
@ -216,6 +226,10 @@ watch(fieldsLength, () => {
refreshScroller();
});
watch(consoleHeight, () => {
resizeResults();
});
onUpdated(() => {
if (propTable.value)
refreshScroller();