mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Add missing control button events to new canvas (no-changelog) (#10471)
This commit is contained in:
parent
973956cc26
commit
fadb5c9ae5
|
@ -470,7 +470,7 @@ watch(() => props.readOnly, setReadonly, {
|
||||||
:position="controlsPosition"
|
:position="controlsPosition"
|
||||||
:show-interactive="false"
|
:show-interactive="false"
|
||||||
:zoom="zoom"
|
:zoom="zoom"
|
||||||
@fit-view="onFitView"
|
@zoom-to-fit="onFitView"
|
||||||
@zoom-in="onZoomIn"
|
@zoom-in="onZoomIn"
|
||||||
@zoom-out="onZoomOut"
|
@zoom-out="onZoomOut"
|
||||||
@reset-zoom="onResetZoom"
|
@reset-zoom="onResetZoom"
|
||||||
|
|
|
@ -14,6 +14,9 @@ const props = withDefaults(
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
'reset-zoom': [];
|
'reset-zoom': [];
|
||||||
|
'zoom-in': [];
|
||||||
|
'zoom-out': [];
|
||||||
|
'zoom-to-fit': [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const isResetZoomVisible = computed(() => props.zoom !== 1);
|
const isResetZoomVisible = computed(() => props.zoom !== 1);
|
||||||
|
@ -21,6 +24,18 @@ const isResetZoomVisible = computed(() => props.zoom !== 1);
|
||||||
function onResetZoom() {
|
function onResetZoom() {
|
||||||
emit('reset-zoom');
|
emit('reset-zoom');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onZoomIn() {
|
||||||
|
emit('zoom-in');
|
||||||
|
}
|
||||||
|
|
||||||
|
function onZoomOut() {
|
||||||
|
emit('zoom-out');
|
||||||
|
}
|
||||||
|
|
||||||
|
function onZoomToFit() {
|
||||||
|
emit('zoom-to-fit');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Controls :show-zoom="false" :show-fit-view="false">
|
<Controls :show-zoom="false" :show-fit-view="false">
|
||||||
|
@ -33,6 +48,7 @@ function onResetZoom() {
|
||||||
size="large"
|
size="large"
|
||||||
icon="search-plus"
|
icon="search-plus"
|
||||||
data-test-id="zoom-in-button"
|
data-test-id="zoom-in-button"
|
||||||
|
@click="onZoomIn"
|
||||||
/>
|
/>
|
||||||
</KeyboardShortcutTooltip>
|
</KeyboardShortcutTooltip>
|
||||||
<KeyboardShortcutTooltip
|
<KeyboardShortcutTooltip
|
||||||
|
@ -44,13 +60,20 @@ function onResetZoom() {
|
||||||
size="large"
|
size="large"
|
||||||
icon="search-minus"
|
icon="search-minus"
|
||||||
data-test-id="zoom-out-button"
|
data-test-id="zoom-out-button"
|
||||||
|
@click="onZoomOut"
|
||||||
/>
|
/>
|
||||||
</KeyboardShortcutTooltip>
|
</KeyboardShortcutTooltip>
|
||||||
<KeyboardShortcutTooltip
|
<KeyboardShortcutTooltip
|
||||||
:label="$locale.baseText('nodeView.zoomToFit')"
|
:label="$locale.baseText('nodeView.zoomToFit')"
|
||||||
:shortcut="{ keys: ['1'] }"
|
:shortcut="{ keys: ['1'] }"
|
||||||
>
|
>
|
||||||
<N8nIconButton type="tertiary" size="large" icon="expand" data-test-id="zoom-to-fit" />
|
<N8nIconButton
|
||||||
|
type="tertiary"
|
||||||
|
size="large"
|
||||||
|
icon="expand"
|
||||||
|
data-test-id="zoom-to-fit"
|
||||||
|
@click="onZoomToFit"
|
||||||
|
/>
|
||||||
</KeyboardShortcutTooltip>
|
</KeyboardShortcutTooltip>
|
||||||
<KeyboardShortcutTooltip
|
<KeyboardShortcutTooltip
|
||||||
v-if="isResetZoomVisible"
|
v-if="isResetZoomVisible"
|
||||||
|
@ -72,5 +95,6 @@ function onResetZoom() {
|
||||||
.vue-flow__controls {
|
.vue-flow__controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--spacing-xs);
|
gap: var(--spacing-xs);
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue