Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(schema-diagram): focus mode (#4586)

Liu Ji384b1ea6331a
diff --git a/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue b/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue
index 4ae8059e4d..49d052ba7e 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue
+++ b/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue
@@ -61,7 +61,7 @@ import ZoomButton from "./ZoomButton.vue";
import { useDragCanvas, useFitView, useSetCenter } from "./composables";
import DummyCanvas from "./DummyCanvas.vue";
import { pushNotification } from "@/store";
-import { ZOOM_RANGE } from "./const";
+import { ZOOM_RANGE } from "../common/const";
const slots = useSlots();
diff --git a/frontend/src/components/SchemaDiagram/Canvas/DummyCanvas.vue b/frontend/src/components/SchemaDiagram/Canvas/DummyCanvas.vue
index b9fd34a2da..1285e83bee 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/DummyCanvas.vue
+++ b/frontend/src/components/SchemaDiagram/Canvas/DummyCanvas.vue
@@ -9,8 +9,6 @@
height: `${resizeParams.rect.height}px`,
}"
>
- <Watermark />
-
<div
class="absolute overflow-visible origin-top-left"
:style="{
@@ -19,6 +17,7 @@
transform: `scale(${resizeParams.zoom})`,
}"
>
+ <Watermark />
<DesktopRenderer />
</div>
diff --git a/frontend/src/components/SchemaDiagram/Canvas/composables/useDragCanvas.ts b/frontend/src/components/SchemaDiagram/Canvas/composables/useDragCanvas.ts
index 47eed0f2e5..d4835deda9 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/composables/useDragCanvas.ts
+++ b/frontend/src/components/SchemaDiagram/Canvas/composables/useDragCanvas.ts
@@ -3,7 +3,7 @@ import { useEventListener } from "@vueuse/core";
import normalizeWheel from "normalize-wheel";
import type { Point } from "../../types";
-import { ZOOM_RANGE } from "../const";
+import { ZOOM_RANGE } from "../../common/const";
import { useDraggable, useSchemaDiagramContext } from "../../common";
import { minmax } from "@/utils";
diff --git a/frontend/src/components/SchemaDiagram/Canvas/composables/useFitView.ts b/frontend/src/components/SchemaDiagram/Canvas/composables/useFitView.ts
index 454b8c3cc6..3dcf4de106 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/composables/useFitView.ts
+++ b/frontend/src/components/SchemaDiagram/Canvas/composables/useFitView.ts
@@ -1,6 +1,6 @@
import { type Ref } from "vue";
-import { ZOOM_RANGE } from "../const";
+import { DEFAULT_PADDINGS, ZOOM_RANGE } from "../../common/const";
import { useSchemaDiagramContext } from "../../common";
import { fitView } from "../libs/fitView";
@@ -12,7 +12,7 @@ export const useFitView = (canvas: Ref<Element | undefined>) => {
const layout = fitView(
canvas.value,
[...geometries.value],
- [10, 20, 40, 20] /* paddings [T,R,B,L] */,
+ DEFAULT_PADDINGS,
[ZOOM_RANGE.min, 1.0] /* [zoomMin, zoomMax] */
);
zoom.value = layout.zoom;
diff --git a/frontend/src/components/SchemaDiagram/Canvas/composables/useSetCenter.ts b/frontend/src/components/SchemaDiagram/Canvas/composables/useSetCenter.ts
index 57526caaca..02f7cb04a0 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/composables/useSetCenter.ts
+++ b/frontend/src/components/SchemaDiagram/Canvas/composables/useSetCenter.ts
@@ -1,22 +1,18 @@
import { type Ref } from "vue";
import type { CenterTarget, CenterTargetType, Rect } from "../../types";
-import { useSchemaDiagramContext } from "../../common";
+import { DEFAULT_PADDINGS, useSchemaDiagramContext } from "../../common";
import { fitView } from "../libs/fitView";
-import { minmax } from "@/utils";
-import { ZOOM_RANGE } from "../const";
export const useSetCenter = (canvas: Ref<Element | undefined>) => {
const { position, zoom, events, rectOfTable } = useSchemaDiagramContext();
- const setCenter = (rect: Rect, padding: number[]) => {
+ const setCenter = (rect: Rect, padding: number[], zooms: number[]) => {
if (!canvas.value) {
return;
}
// Fit view according to the center rect with limited zoom range.
- const zoomMin = minmax(zoom.value, ZOOM_RANGE.min, 0.5);
- const zoomMax = minmax(zoom.value, zoomMin, 1);
- const layout = fitView(canvas.value, [rect], padding, [zoomMin, zoomMax]);
+ const layout = fitView(canvas.value, [rect], padding, zooms);
zoom.value = layout.zoom;
position.value = {
x: layout.rect.x,
@@ -25,15 +21,15 @@ export const useSetCenter = (canvas: Ref<Element | undefined>) => {
};
events.on("set-center", (e) => {
- const { padding = [0, 0, 0, 0] } = e;
+ const { padding = DEFAULT_PADDINGS, zooms = [zoom.value, zoom.value] } = e;
if (isTypedCenterTarget(e, "point")) {
const center = e.target;
- setCenter({ ...center, width: 0, height: 0 }, padding);
+ setCenter({ ...center, width: 0, height: 0 }, padding, zooms);
} else if (isTypedCenterTarget(e, "rect")) {
- setCenter(e.target, padding);
+ setCenter(e.target, padding, zooms);
} else if (isTypedCenterTarget(e, "table")) {
const rect = rectOfTable(e.target);
- setCenter(rect, padding);
+ setCenter(rect, padding, zooms);
} else {
console.assert(false, `unknown set-center target "${e}"`);
}
diff --git a/frontend/src/components/SchemaDiagram/Canvas/libs/fitView.ts b/frontend/src/components/SchemaDiagram/Canvas/libs/fitView.ts
index 65b69e7e93..f31e53a401 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/libs/fitView.ts
+++ b/frontend/src/components/SchemaDiagram/Canvas/libs/fitView.ts
@@ -1,6 +1,6 @@
import type { Geometry, Rect } from "../../types";
import { calcBBox, fitBBox } from "../../common";
-import { ZOOM_RANGE } from "../const";
+import { ZOOM_RANGE } from "../../common/const";
export const fitView = (
canvas: Element,
diff --git a/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue b/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue
index 38bfd277ce..edc7e6bfa0 100644
--- a/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue
+++ b/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue
@@ -1,5 +1,7 @@
<template>
<SVGLine
+ class="transition-opacity"
+ :class="lineClasses"
:path="path"
:decorators="[startManyArrow]"
:bb-edge-from="`${fk.from.table.name}.${fk.from.column}`"
@@ -15,6 +17,7 @@
import { computed, onMounted, ref } from "vue";
import { TableMetadata } from "@/types/proto/store/database";
+import type { VueClass } from "@/utils";
import { Point, Rect, Path, ForeignKey } from "../types";
import {
segmentOverlap1D,
@@ -33,7 +36,8 @@ const props = withDefaults(
{}
);
-const { zoom, idOfTable, rectOfTable, events } = useSchemaDiagramContext();
+const { zoom, focusedTables, idOfTable, rectOfTable, events } =
+ useSchemaDiagramContext();
const fromRect = ref<Rect>({ x: 0, y: 0, width: 0, height: 0 });
const toRect = ref<Rect>({ x: 0, y: 0, width: 0, height: 0 });
const path = computed((): Path => {
@@ -57,6 +61,23 @@ const path = computed((): Path => {
return generateLine(from, fromPort, to, toPort);
});
+
+const lineClasses = computed((): VueClass => {
+ const classes: string[] = [];
+ if (focusedTables.value.size > 0) {
+ const { from, to } = props.fk;
+ if (
+ focusedTables.value.has(from.table) ||
+ focusedTables.value.has(to.table)
+ ) {
+ classes.push("opacity-100");
+ } else {
+ classes.push("opacity-20");
+ }
+ }
+ return classes;
+});
+
const findRect = (table: TableMetadata, columnName: string): Rect => {
const id = idOfTable(table);
const tableRect = rectOfTable(table);
diff --git a/frontend/src/components/SchemaDiagram/ER/TableNode.vue b/frontend/src/components/SchemaDiagram/ER/TableNode.vue
index 9101827d99..c123902067 100644
--- a/frontend/src/components/SchemaDiagram/ER/TableNode.vue
+++ b/frontend/src/components/SchemaDiagram/ER/TableNode.vue
@@ -1,6 +1,7 @@
<template>
<div
- class="absolute overflow-hidden rounded-md shadow-lg border-b border-gray-200 bg-white w-[16rem] divide-y z-[10]"
+ class="absolute overflow-hidden rounded-md shadow-lg border-b border-gray-200 bg-white w-[16rem] divide-y z-[10] transition-opacity"
+ :class="tableClasses"
bb-node-type="table"
:bb-node-id="dummy ? `dummy-${idOfTable(table)}` : idOfTable(table)"
:bb-status="tableStatus(table)"
@@ -15,6 +16,13 @@
'background-color': tableColor,
}"
>
+ <FocusButton
+ :table="table"
+ :set-center="false"
+ class="invisible group-hover:visible !absolute top-[50%] -mt-[9px] left-1 text-main group-hover:bg-white/70 group-hover:!text-main"
+ focused-class="!text-white"
+ />
+
<template v-if="schema.name !== ''">
<span :class="[isTableDropped && 'line-through']">
{{ schema.name }}
@@ -28,7 +36,7 @@
<button
v-if="editable"
- class="invisible group-hover:visible absolute top-[50%] -mt-2 right-1 text-main bg-white/70 hover:bg-gray-200 p-0.5 rounded"
+ class="invisible group-hover:visible absolute top-[50%] -mt-[9px] right-1 text-main bg-white/70 hover:bg-gray-200 p-0.5 rounded"
@click="events.emit('edit-table', { schema, table })"
>
<heroicons-outline:pencil class="w-4 h-4" />
@@ -85,13 +93,15 @@ import {
SchemaMetadata,
TableMetadata,
} from "@/types/proto/store/database";
+import type { VueClass } from "@/utils";
import {
useSchemaDiagramContext,
isPrimaryKey,
isIndex,
useGeometry,
+ FocusButton,
} from "../common";
-import { VueClass } from "@/utils";
+import { isFocusedForeignTable } from "./libs/isFocusedFKTable";
const props = withDefaults(
defineProps<{
@@ -100,9 +110,12 @@ const props = withDefaults(
}>(),
{}
);
+
const {
dummy,
editable,
+ focusedTables,
+ foreignKeys,
idOfTable,
rectOfTable,
schemaStatus,
@@ -154,6 +167,22 @@ const isTableChanged = computed(() => {
return tableStatus(props.table) === "changed";
});
+const tableClasses = computed((): VueClass => {
+ const classes: string[] = [];
+ if (focusedTables.value.size > 0) {
+ if (focusedTables.value.has(props.table)) {
+ classes.push("opacity-100");
+ } else if (
+ isFocusedForeignTable(props.table, focusedTables.value, foreignKeys.value)
+ ) {
+ classes.push("opacity-100");
+ } else {
+ classes.push("opacity-20 hover:opacity-100");
+ }
+ }
+ return classes;
+});
+
const columnClasses = (column: ColumnMetadata): VueClass => {
const classes: string[] = [];
if (editable.value) {
diff --git a/frontend/src/components/SchemaDiagram/ER/libs/isFocusedFKTable.ts b/frontend/src/components/SchemaDiagram/ER/libs/isFocusedFKTable.ts
new file mode 100644
index 0000000000..50a668ac24
--- /dev/null
+++ b/frontend/src/components/SchemaDiagram/ER/libs/isFocusedFKTable.ts
@@ -0,0 +1,21 @@
+import type { TableMetadata } from "@/types/proto/store/database";
+import type { ForeignKey } from "../../types";
+
+export const isFocusedForeignTable = (
+ table: TableMetadata,
+ focusedTables: Set<TableMetadata>,
+ foreignKeys: ForeignKey[]
+): boolean => {
+ const fks = foreignKeys.filter(
+ (fk) => fk.from.table === table || fk.to.table === table
+ );
+ return fks.some((fk) => {
+ if (fk.from.table === table) {
+ return focusedTables.has(fk.to.table);
+ }
+ if (fk.to.table === table) {
+ return focusedTables.has(fk.from.table);
+ }
+ return false;
+ });
+};
diff --git a/frontend/src/components/SchemaDiagram/Navigator/Tree.vue b/frontend/src/components/SchemaDiagram/Navigator/Tree.vue
index 3dbc9a18ee..dc924d51f8 100644
--- a/frontend/src/components/SchemaDiagram/Navigator/Tree.vue
+++ b/frontend/src/components/SchemaDiagram/Navigator/Tree.vue
@@ -11,6 +11,7 @@
:expand-on-click="true"
:render-label="renderLabel"
:render-prefix="renderPrefix"
+ :render-suffix="renderSuffix"
:node-props="nodeProps"
/>
</template>
@@ -21,9 +22,10 @@ import { NTree, type TreeOption } from "naive-ui";
import { useSchemaDiagramContext } from "../common";
import { TreeNode } from "./types";
-import { Label, Prefix } from "./TreeNode";
+import { Label, Prefix, Suffix } from "./TreeNode";
import { isDescendantOf } from "@/utils";
import { isTypedNode } from "./utils";
+import { DEFAULT_PADDINGS } from "../common/const";
const props = withDefaults(
defineProps<{
@@ -83,6 +85,12 @@ const renderPrefix = ({ option }: { option: TreeOption }) => {
return h(Prefix, { node });
};
+// Render icons after nodes.
+const renderSuffix = ({ option }: { option: TreeOption }) => {
+ const node = option as any as TreeNode;
+ return h(Suffix, { node });
+};
+
const nodeProps = ({ option }: { option: TreeOption }) => {
const node = option as TreeNode;
return {
@@ -96,6 +104,7 @@ const nodeProps = ({ option }: { option: TreeOption }) => {
events.emit("set-center", {
type: "table",
target: node.data,
+ padding: DEFAULT_PADDINGS,
});
}
}
@@ -115,11 +124,6 @@ const nodeProps = ({ option }: { option: TreeOption }) => {
.bb-schema-diagram-nav-tree .n-tree-node-content__prefix {
@apply shrink-0 !mr-1;
}
-.bb-schema-diagram-nav-tree.project
- .n-tree-node[data-node-type="project"]
- .n-tree-node-content__prefix {
- @apply hidden;
-}
.bb-schema-diagram-nav-tree .n-tree-node-content__text {
@apply truncate mr-1;
}
diff --git a/frontend/src/components/SchemaDiagram/Navigator/TreeNode/Suffix.vue b/frontend/src/components/SchemaDiagram/Navigator/TreeNode/Suffix.vue
new file mode 100644
index 0000000000..a502b71505
--- /dev/null
+++ b/frontend/src/components/SchemaDiagram/Navigator/TreeNode/Suffix.vue
@@ -0,0 +1,27 @@
+<template>
+ <template v-if="node.type === 'schema'">
+ <!-- nothing -->
+ </template>
+ <template v-if="node.type === 'table'">
+ <FocusButton
+ :table="(node as TreeNode<'table'>).data"
+ :set-center="true"
+ class="focus-btn"
+ />
+ </template>
+</template>
+
+<script lang="ts" setup>
+import type { TreeNode } from "../types";
+import { FocusButton } from "../../common";
+
+defineProps<{
+ node: TreeNode;
+}>();
+</script>
+
+<style lang="postcss">
+.bb-schema-diagram-nav-tree .n-tree-node:hover .focus-btn {
+ @apply !visible;
+}
+</style>
diff --git a/frontend/src/components/SchemaDiagram/Navigator/TreeNode/index.ts b/frontend/src/components/SchemaDiagram/Navigator/TreeNode/index.ts
index 4b063aa525..b27f779ae4 100644
--- a/frontend/src/components/SchemaDiagram/Navigator/TreeNode/index.ts
+++ b/frontend/src/components/SchemaDiagram/Navigator/TreeNode/index.ts
@@ -1,4 +1,5 @@
import Label from "./Label.vue";
import Prefix from "./Prefix.vue";
+import Suffix from "./Suffix.vue";
-export { Label, Prefix };
+export { Label, Prefix, Suffix };
diff --git a/frontend/src/components/SchemaDiagram/SchemaDiagram.vue b/frontend/src/components/SchemaDiagram/SchemaDiagram.vue
index ac83fcf2f5..a30d5b2855 100644
--- a/frontend/src/components/SchemaDiagram/SchemaDiagram.vue
+++ b/frontend/src/components/SchemaDiagram/SchemaDiagram.vue
@@ -93,6 +93,7 @@ const zoom = ref(1);
const position = ref<Point>({ x: 0, y: 0 });
const panning = ref(false);
const geometries = ref(new Set<Geometry>());
+const focusedTables = ref(new Set<TableMetadata>());
const render = () => {
nextTick(() => {
@@ -209,12 +210,14 @@ provideSchemaDiagramContext({
database: toRef(props, "database"),
databaseMetadata: toRef(props, "databaseMetadata"),
editable: computed(() => props.editable),
+ foreignKeys,
dummy,
busy,
zoom,
position,
panning,
geometries,
+ focusedTables,
idOfTable,
rectOfTable,
render,
@@ -229,6 +232,7 @@ provideSchemaDiagramContext({
watch(
() => props.databaseMetadata,
async () => {
+ focusedTables.value = new Set();
await layout();
initialized.value = true;
nextTick(() => {
diff --git a/frontend/src/components/SchemaDiagram/common/FocusButton.vue b/frontend/src/components/SchemaDiagram/common/FocusButton.vue
new file mode 100644
index 0000000000..c134e7ce85
--- /dev/null
+++ b/frontend/src/components/SchemaDiagram/common/FocusButton.vue
@@ -0,0 +1,56 @@
+<template>
+ <button
+ class="p-0.5 rounded hover:bg-gray-200"
+ :class="[isFocused && focusedClass, isFocused ? '!visible' : 'invisible']"
+ @click="toggleFocus"
+ >
+ <!-- TODO(Jim): replace this raw SVG with heroicons-outline:viewfinder-circle when supported -->
+ <FocusIcon class="w-4 h-4" />
+ </button>
+</template>
+
+<script lang="ts" setup>
+import { computed } from "vue";
+
+import type { TableMetadata } from "@/types/proto/store/database";
+import FocusIcon from "./FocusIcon.vue";
+import { expectedZoomRange, useSchemaDiagramContext } from ".";
+import { DEFAULT_PADDINGS } from "./const";
+import { VueClass } from "@/utils";
+
+const props = withDefaults(
+ defineProps<{
+ table: TableMetadata;
+ focusedClass?: VueClass;
+ setCenter?: boolean;
+ }>(),
+ {
+ focusedClass: "",
+ setCenter: true,
+ }
+);
+
+const { zoom, focusedTables, events } = useSchemaDiagramContext();
+
+const isFocused = computed(() => {
+ return focusedTables.value.has(props.table);
+});
+
+const toggleFocus = (e: Event) => {
+ e.stopPropagation();
+ const on = !isFocused.value;
+ if (on) {
+ focusedTables.value.add(props.table);
+ } else {
+ focusedTables.value.delete(props.table);
+ }
+ if (props.setCenter) {
+ events.emit("set-center", {
+ type: "table",
+ target: props.table,
+ padding: DEFAULT_PADDINGS,
+ zooms: on ? expectedZoomRange(zoom.value, 0.5, 1) : undefined,
+ });
+ }
+};
+</script>
diff --git a/frontend/src/components/SchemaDiagram/common/FocusIcon.vue b/frontend/src/components/SchemaDiagram/common/FocusIcon.vue
new file mode 100644
index 0000000000..325911668a
--- /dev/null
+++ b/frontend/src/components/SchemaDiagram/common/FocusIcon.vue
@@ -0,0 +1,15 @@
+<template>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke-width="2"
+ stroke="currentColor"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M7.5 3.75H6A2.25 2.25 0 003.75 6v1.5M16.5 3.75H18A2.25 2.25 0 0120.25 6v1.5m0 9V18A2.25 2.25 0 0118 20.25h-1.5m-9 0H6A2.25 2.25 0 013.75 18v-1.5M15 12a3 3 0 11-6 0 3 3 0 016 0z"
+ />
+ </svg>
+</template>
diff --git a/frontend/src/components/SchemaDiagram/Canvas/const.ts b/frontend/src/components/SchemaDiagram/common/const.ts
similarity index 50%
rename from frontend/src/components/SchemaDiagram/Canvas/const.ts
rename to frontend/src/components/SchemaDiagram/common/const.ts
index 72ea786ef4..e040fb4142 100644
--- a/frontend/src/components/SchemaDiagram/Canvas/const.ts
+++ b/frontend/src/components/SchemaDiagram/common/const.ts
@@ -2,3 +2,5 @@ export const ZOOM_RANGE = {
max: 2, // 200%
min: 0.05, // 5%
};
+
+export const DEFAULT_PADDINGS = [10, 20, 40, 20]; /* [T,R,B,L] */
diff --git a/frontend/src/components/SchemaDiagram/common/index.ts b/frontend/src/components/SchemaDiagram/common/index.ts
index dcf15f1d86..86253564bc 100644
--- a/frontend/src/components/SchemaDiagram/common/index.ts
+++ b/frontend/src/components/SchemaDiagram/common/index.ts
@@ -1,4 +1,10 @@
+import FocusButton from "./FocusButton.vue";
+
+export * from "./const";
export * from "./context";
export * from "./useDraggable";
export * from "./geometry";
export * from "./schema";
+export * from "./utils";
+
+export { FocusButton };
diff --git a/frontend/src/components/SchemaDiagram/common/utils.ts b/frontend/src/components/SchemaDiagram/common/utils.ts
new file mode 100644
index 0000000000..fed652479a
--- /dev/null
+++ b/frontend/src/components/SchemaDiagram/common/utils.ts
@@ -0,0 +1,14 @@
+import { ZOOM_RANGE } from "./const";
+
+export const expectedZoomRange = (target: number, min: number, max: number) => {
+ const range = {
+ min: Math.max(ZOOM_RANGE.min, min),
+ max: Math.min(ZOOM_RANGE.max, max),
+ };
+ // If the target is in the range, don't zoom.
+ if (target >= range.min && target <= range.max) {
+ return [target, target];
+ }
+ // Zoom to limited range otherwise
+ return [Math.min(target, range.min), Math.max(target, range.max)];
+};
diff --git a/frontend/src/components/SchemaDiagram/types/context.ts b/frontend/src/components/SchemaDiagram/types/context.ts
index a160393827..f8615836b1 100644
--- a/frontend/src/components/SchemaDiagram/types/context.ts
+++ b/frontend/src/components/SchemaDiagram/types/context.ts
@@ -9,7 +9,8 @@ import type {
} from "@/types/proto/store/database";
import type { Database } from "@/types";
import type { Geometry, Point, Rect } from "./geometry";
-import { EditStatus } from "./edit";
+import type { EditStatus } from "./edit";
+import type { ForeignKey } from "./schema";
// This is an abstract Schema Diagram context including states, methods and
// events. This should be implemented in the root component of SchemaDiagram
@@ -21,12 +22,14 @@ export type SchemaDiagramContext = {
editable: Ref<boolean>;
// States
+ foreignKeys: Ref<ForeignKey[]>;
dummy: Ref<boolean>;
busy: Ref<boolean>;
zoom: Ref<number>;
position: Ref<Point>;
panning: Ref<boolean>;
geometries: Ref<Set<Geometry>>;
+ focusedTables: Ref<Set<TableMetadata>>;
// Methods
idOfTable: (table: TableMetadata) => string;
@@ -64,4 +67,5 @@ export type CenterTarget<T extends CenterTargetType = CenterTargetType> = {
point: Point;
}[T];
padding?: number[]; // [T,R,B,L]
+ zooms?: number[]; // [min, max]
};