feat(sidebar): add indentation and font size settings
This commit is contained in:
1 parent
98df975614
commit
745483cd6c
16 files changed
+164
-13
No files matched your search
@@ -82,6 +82,7 @@ const showConnectedConnectionsOnly = ref(false);
|
||||
const isDisconnectingAllActiveConnections = ref(false);
|
||||
const searchInputRef = ref<HTMLInputElement>();
|
||||
const rootRef = ref<HTMLElement>();
|
||||
const sidebarRootStyle = computed<Record<string, string>>(() => ({ fontSize: `${settingsStore.editorSettings.sidebarFontSize}px` }));
|
||||
const pointerInsideTree = ref(false);
|
||||
const treeScrollerRef = ref<InstanceType<typeof RecycleScroller> | null>(null);
|
||||
const plainTreeScrollerRef = ref<HTMLElement | null>(null);
|
||||
@@ -691,7 +692,7 @@ function measureSidebarTreeContentWidth() {
|
||||
if (!context) return;
|
||||
const style = window.getComputedStyle(rootRef.value);
|
||||
context.font = style.font || `${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
|
||||
sidebarTreeContentWidth.value = sidebarTreeNaturalContentWidth(sidebarTreeNaturalWidthItems.value, (text) => context.measureText(text).width);
|
||||
sidebarTreeContentWidth.value = sidebarTreeNaturalContentWidth(sidebarTreeNaturalWidthItems.value, (text) => context.measureText(text).width, settingsStore.editorSettings.sidebarIndent);
|
||||
void nextTick(scheduleSidebarScrollMetricsUpdate);
|
||||
}
|
||||
|
||||
@@ -705,7 +706,15 @@ function scheduleSidebarTreeContentWidthMeasure() {
|
||||
}
|
||||
|
||||
watch(
|
||||
[flatNodes, () => settingsStore.editorSettings.sidebarObjectInfoMode, () => settingsStore.editorSettings.sidebarShowConnectionNotes, () => settingsStore.editorSettings.sidebarHiddenTablePrefixes, () => settingsStore.editorSettings.uiFontFamily, () => settingsStore.editorSettings.uiScale],
|
||||
[
|
||||
flatNodes,
|
||||
() => settingsStore.editorSettings.sidebarObjectInfoMode,
|
||||
() => settingsStore.editorSettings.sidebarShowConnectionNotes,
|
||||
() => settingsStore.editorSettings.sidebarHiddenTablePrefixes,
|
||||
() => settingsStore.editorSettings.uiFontFamily,
|
||||
() => settingsStore.editorSettings.uiScale,
|
||||
() => settingsStore.editorSettings.sidebarFontSize,
|
||||
],
|
||||
scheduleSidebarCommentLabelMeasure,
|
||||
{
|
||||
flush: "post",
|
||||
@@ -713,7 +722,7 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
watch([sidebarTreeNaturalWidthItems, () => settingsStore.editorSettings.uiFontFamily, () => settingsStore.editorSettings.uiScale], scheduleSidebarTreeContentWidthMeasure, {
|
||||
watch([sidebarTreeNaturalWidthItems, () => settingsStore.editorSettings.uiFontFamily, () => settingsStore.editorSettings.uiScale, () => settingsStore.editorSettings.sidebarIndent, () => settingsStore.editorSettings.sidebarFontSize], scheduleSidebarTreeContentWidthMeasure, {
|
||||
flush: "post",
|
||||
immediate: true,
|
||||
});
|
||||
@@ -1988,7 +1997,7 @@ defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="rootRef" class="h-full min-h-0 flex flex-col text-sm select-none" @pointerenter="pointerInsideTree = true" @pointerleave="pointerInsideTree = false">
|
||||
<div ref="rootRef" class="h-full min-h-0 flex flex-col select-none" :style="sidebarRootStyle" @pointerenter="pointerInsideTree = true" @pointerleave="pointerInsideTree = false">
|
||||
<SidebarTreeRuntimeHost
|
||||
:ref="bindSidebarTreeRuntimeHost"
|
||||
:node="sidebarTreeRuntimeInitialNode"
|
||||
|
||||
@@ -742,7 +742,7 @@ const labelWidthClass = computed(() => {
|
||||
|
||||
watch(() => [isRightAlignedComment(), visibleLabel(activeNode.value), trailingComment.value, trailingCommentLayoutRef.value, trailingCommentLeadingRef.value], refreshTrailingCommentMeasurement, { flush: "post", immediate: true });
|
||||
|
||||
const paddingLeft = computed(() => treeItemPaddingLeft(props.depth));
|
||||
const paddingLeft = computed(() => treeItemPaddingLeft(props.depth, settingsStore.editorSettings.sidebarIndent));
|
||||
|
||||
const tableSearchParentId = computed(() => activeNode.value.tableSearchParentId || "");
|
||||
|
||||
@@ -1424,8 +1424,9 @@ function onKeydown(event: KeyboardEvent) {
|
||||
<style>
|
||||
.sidebar-object-comment {
|
||||
color: var(--muted-foreground);
|
||||
font-size: 12px;
|
||||
line-height: 1rem;
|
||||
/* Relative to the sidebar tree root font size so comments follow the sidebarFontSize setting. */
|
||||
font-size: 0.85em;
|
||||
line-height: 1.25;
|
||||
opacity: 0.6;
|
||||
/* Sidebar rows repaint on hover; avoid heavier font shaping and fallback here. */
|
||||
text-rendering: auto;
|
||||
@@ -1439,7 +1440,7 @@ function onKeydown(event: KeyboardEvent) {
|
||||
|
||||
.sidebar-object-comment--windows {
|
||||
font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
|
||||
font-size: 14px;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user