diff --git a/browser_tests/tests/selectionToolbox.spec.ts b/browser_tests/tests/selectionToolbox.spec.ts index 778e8f88b8d..06fbeb5efec 100644 --- a/browser_tests/tests/selectionToolbox.spec.ts +++ b/browser_tests/tests/selectionToolbox.spec.ts @@ -96,6 +96,47 @@ test.describe('Selection Toolbox', { tag: ['@screenshot', '@ui'] }, () => { }) }) + test('aligns the selection to its top edge from the align bar and from More Options', async ({ + comfyPage + }) => { + const { page } = comfyPage + await comfyPage.canvasOps.pan({ x: -300, y: 0 }, { x: 600, y: 60 }) + const titles = ['Empty Latent Image', 'KSampler'] + const nodes = await Promise.all( + titles.map((title) => comfyPage.nodeOps.getNodeRefByTitle(title)) + ) + const tops = () => + Promise.all( + nodes.map(async (node) => (await node.getProperty('pos'))[1]) + ) + const before = await tops() + const selectionTop = Math.min(...before) + await comfyPage.nodeOps.selectNodes(titles) + + await test.step('align from the align bar', async () => { + await page.getByRole('button', { name: 'Align and distribute' }).click() + await page.getByRole('button', { name: 'Align top', exact: true }).click() + await expect.poll(tops).toEqual([selectionTop, selectionTop]) + }) + + await test.step('undo restores the original rows', async () => { + await comfyPage.keyboard.undo() + await expect.poll(tops).toEqual(before) + }) + + await test.step('align from the More Options menu', async () => { + await comfyPage.canvasOps.clickEmptySpace() + await comfyPage.nodeOps.selectNodes(titles) + await page.getByTestId('more-options-button').click() + await comfyPage.contextMenu.menuItem('Arrange').click() + const arrange = page.getByRole('menu', { name: 'Arrange', exact: true }) + await arrange + .getByRole('menuitem', { name: 'Align top', exact: true }) + .click() + await expect.poll(tops).toEqual([selectionTop, selectionTop]) + }) + }) + test('shows selection toolbox', async ({ comfyPage }) => { const selectedTitles = ['KSampler', 'CLIP Text Encode (Prompt)'] await expect(comfyPage.selectionToolbox).toBeHidden() diff --git a/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-nodes-border-chromium-linux.png b/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-nodes-border-chromium-linux.png index 32150c7d112..58a159e1a4f 100644 Binary files a/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-nodes-border-chromium-linux.png and b/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-nodes-border-chromium-linux.png differ diff --git a/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-selections-border-chromium-linux.png b/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-selections-border-chromium-linux.png index 6b880c97e84..1d946af7444 100644 Binary files a/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-selections-border-chromium-linux.png and b/browser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-selections-border-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/interactions/node/contextMenuCoverage.spec.ts b/browser_tests/tests/vueNodes/interactions/node/contextMenuCoverage.spec.ts index dcd48088b50..8e42e26020d 100644 --- a/browser_tests/tests/vueNodes/interactions/node/contextMenuCoverage.spec.ts +++ b/browser_tests/tests/vueNodes/interactions/node/contextMenuCoverage.spec.ts @@ -154,13 +154,13 @@ test.describe( const menu = comfyPage.contextMenu.ariaMenu await menu .getByRole('menuitem', { - name: 'Align Selected To', + name: 'Arrange', exact: true }) .hover() const topItem = menu - .getByRole('menuitem', { name: 'Top', exact: true }) + .getByRole('menuitem', { name: 'Align top', exact: true }) .last() await expect(topItem).toBeVisible() await topItem.click() @@ -180,7 +180,7 @@ test.describe( }) }) - test('should distribute selected nodes via Distribute Nodes submenu', async ({ + test('should distribute selected nodes via the Arrange submenu', async ({ comfyPage }) => { const threeNodes = ['Load Checkpoint', 'KSampler', 'Empty Latent Image'] @@ -190,14 +190,14 @@ test.describe( const menu = comfyPage.contextMenu.ariaMenu await menu .getByRole('menuitem', { - name: 'Distribute Nodes', + name: 'Arrange', exact: true }) .hover() const horizontalItem = menu .getByRole('menuitem', { - name: 'Horizontal', + name: 'Distribute horizontally', exact: true }) .last() diff --git a/docs/architecture/domains/boundaries.json b/docs/architecture/domains/boundaries.json index 1dbd2117da9..b0634df3863 100644 --- a/docs/architecture/domains/boundaries.json +++ b/docs/architecture/domains/boundaries.json @@ -2693,6 +2693,8 @@ "src/components/graph/SelectionToolbox.vue", "src/components/graph/selectionGrid/SelectionGapHandles.test.ts", "src/components/graph/selectionGrid/SelectionGapHandles.vue", + "src/components/graph/selectionToolbox/AlignButton.test.ts", + "src/components/graph/selectionToolbox/AlignButton.vue", "src/components/graph/selectionToolbox/BypassButton.test.ts", "src/components/graph/selectionToolbox/BypassButton.vue", "src/components/graph/selectionToolbox/ColorPickerButton.test.ts", @@ -2712,6 +2714,8 @@ "src/components/graph/selectionToolbox/NodeOptionsButton.vue", "src/components/graph/selectionToolbox/RefreshSelectionButton.vue", "src/components/graph/selectionToolbox/SaveToSubgraphLibrary.vue", + "src/components/graph/selectionToolbox/SelectionToolboxBar.vue", + "src/components/graph/selectionToolbox/selectionToolboxBar.ts", "src/components/graph/selectionToolbox/TidyUpButton.test.ts", "src/components/graph/selectionToolbox/TidyUpButton.vue" ] diff --git a/docs/architecture/domains/records/selection-toolbox.domain.json b/docs/architecture/domains/records/selection-toolbox.domain.json index 3e02f98a772..cd39020ea42 100644 --- a/docs/architecture/domains/records/selection-toolbox.domain.json +++ b/docs/architecture/domains/records/selection-toolbox.domain.json @@ -59,6 +59,14 @@ "path": "src/components/graph/selectionGrid/useTidySession.ts", "role": "integration" }, + { + "path": "src/components/graph/selectionToolbox/AlignButton.test.ts", + "role": "presentation" + }, + { + "path": "src/components/graph/selectionToolbox/AlignButton.vue", + "role": "presentation" + }, { "path": "src/components/graph/selectionToolbox/BypassButton.test.ts", "role": "presentation" @@ -135,6 +143,14 @@ "path": "src/components/graph/selectionToolbox/SaveToSubgraphLibrary.vue", "role": "presentation" }, + { + "path": "src/components/graph/selectionToolbox/SelectionToolboxBar.vue", + "role": "presentation" + }, + { + "path": "src/components/graph/selectionToolbox/selectionToolboxBar.ts", + "role": "presentation" + }, { "path": "src/components/graph/selectionToolbox/TidyUpButton.test.ts", "role": "presentation" @@ -286,6 +302,7 @@ "src/components/graph/selectionToolbox/InfoButton.test.ts", "src/components/graph/selectionToolbox/MaskEditorButton.test.ts", "src/components/graph/selectionToolbox/TidyUpButton.test.ts", + "src/components/graph/selectionToolbox/AlignButton.test.ts", "src/components/graph/selectionGrid/SelectionGapHandles.test.ts" ] }, diff --git a/src/components/graph/NodeContextMenu.test.ts b/src/components/graph/NodeContextMenu.test.ts index c3e19f5b48f..3869af0f936 100644 --- a/src/components/graph/NodeContextMenu.test.ts +++ b/src/components/graph/NodeContextMenu.test.ts @@ -1,4 +1,4 @@ -import { render, screen, waitFor } from '@testing-library/vue' +import { render, screen, waitFor, within } from '@testing-library/vue' import userEvent from '@testing-library/user-event' import { fromPartial } from '@total-typescript/shoehorn' import { beforeEach, describe, expect, it } from 'vitest' @@ -9,7 +9,9 @@ import { showNodeOptions, toggleNodeOptions } from '@/composables/graph/useMoreOptionsMenu' +import { LGraphNode } from '@/lib/litegraph/src/litegraph' import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' +import { setCanvasSelection } from '@/utils/__tests__/canvasSelectionTestUtils' import NodeContextMenu from './NodeContextMenu.vue' @@ -97,6 +99,34 @@ describe('NodeContextMenu', () => { expect(await screen.findByRole('menu')).toBeVisible() }) + it('groups Tidy up, the align options and the distribute options in the Arrange submenu', async () => { + setCanvasSelection([new LGraphNode('First'), new LGraphNode('Second')]) + render(NodeContextMenu, { global: { plugins: [i18n] } }) + const user = userEvent.setup({ pointerEventsCheck: 0 }) + + toggleNodeOptions(new MouseEvent('click', { clientX: 100, clientY: 120 })) + await user.click( + await screen.findByRole('menuitem', { name: 'contextMenu.Arrange' }) + ) + + await waitFor(() => expect(screen.getAllByRole('menu')).toHaveLength(2)) + const submenu = screen.getAllByRole('menu')[1] + expect( + within(submenu) + .getAllByRole('menuitem') + .map((item) => item.textContent) + ).toEqual([ + 'g.tidyUp', + 'contextMenu.Align top', + 'contextMenu.Align bottom', + 'contextMenu.Align left', + 'contextMenu.Align right', + 'contextMenu.Distribute horizontally', + 'contextMenu.Distribute vertically' + ]) + expect(within(submenu).getAllByRole('separator')).toHaveLength(2) + }) + it('reopens at another control when its press dismisses the menu', async () => { renderWithControls() const user = userEvent.setup({ pointerEventsCheck: 0 }) diff --git a/src/components/graph/NodeContextMenu.vue b/src/components/graph/NodeContextMenu.vue index d81e157ee38..cef13527551 100644 --- a/src/components/graph/NodeContextMenu.vue +++ b/src/components/graph/NodeContextMenu.vue @@ -47,6 +47,7 @@ import { registerNodeOptionsInstance, useMoreOptionsMenu } from '@/composables/graph/useMoreOptionsMenu' +import { isSubMenuOption } from '@/composables/graph/menuOption' import type { MenuOption } from '@/composables/graph/menuOption' import { useNodeCustomization } from '@/composables/graph/useNodeCustomization' import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' @@ -104,7 +105,7 @@ function convertToMenuItem(option: MenuOption): NodeMenuItem { icon: option.icon, radioGroup: { value: getCurrentShape()?.localizedName ?? '', - options: option.submenu.map((sub) => ({ + options: option.submenu.filter(isSubMenuOption).map((sub) => ({ value: sub.label, label: sub.label, command: sub.action @@ -119,13 +120,18 @@ function convertToMenuItem(option: MenuOption): NodeMenuItem { icon: option.icon, disabled: option.disabled, shortcut: option.shortcut, - items: option.submenu.map((sub) => ({ - label: sub.label, - icon: sub.icon, - color: sub.color, - disabled: sub.disabled, - command: sub.action - })) + items: option.submenu.map( + (sub): NodeMenuItem => + isSubMenuOption(sub) + ? { + label: sub.label, + icon: sub.icon, + color: sub.color, + disabled: sub.disabled, + command: sub.action + } + : { separator: true } + ) } } diff --git a/src/components/graph/SelectionToolbox.test.ts b/src/components/graph/SelectionToolbox.test.ts index ffe6ba5d441..412cc7f9d80 100644 --- a/src/components/graph/SelectionToolbox.test.ts +++ b/src/components/graph/SelectionToolbox.test.ts @@ -2,10 +2,12 @@ import { fireEvent, render, screen } from '@testing-library/vue' import userEvent from '@testing-library/user-event' import { beforeEach, describe, expect, it, vi } from 'vitest' -import { defineComponent } from 'vue' +import { defineComponent, h, watch } from 'vue' +import type { Component } from 'vue' import { createI18n } from 'vue-i18n' import SelectionToolbox from '@/components/graph/SelectionToolbox.vue' +import { useSelectionToolboxPosition } from '@/composables/canvas/useSelectionToolboxPosition' import { LGraphNode } from '@/lib/litegraph/src/LGraphNode' import { useSettingStore } from '@/platform/settings/settingStore' import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' @@ -114,6 +116,7 @@ describe('SelectionToolbox', () => { info: 'Node Info', bookmark: 'Save to Library', frameNodes: 'Frame Nodes', + alignAndDistribute: 'Align and distribute', moreOptions: 'More Options', refreshNode: 'Refresh Node' } @@ -136,7 +139,10 @@ describe('SelectionToolbox', () => { mockSettingValues() }) - function renderComponent(props = {}): { container: Element } { + function renderComponent( + props = {}, + barStubs: Record = {} + ): { container: Element } { const { container } = render(SelectionToolbox, { props, global: { @@ -185,7 +191,8 @@ describe('SelectionToolbox', () => { MoreOptions: { template: ' - - -
- - - {{ hasMixedGaps ? t('g.mixedGaps') : gap }} - -
-
-
+ +
+ + + {{ hasMixedGaps ? t('g.mixedGaps') : gap }} + +
+
import { clamp } from 'es-toolkit' -import type { FocusOutsideEvent, PointerDownOutsideEvent } from 'reka-ui' -import { - PopoverContent, - PopoverPortal, - PopoverRoot, - PopoverTrigger -} from 'reka-ui' -import { onBeforeUnmount, ref, watch } from 'vue' +import { PopoverRoot, PopoverTrigger } from 'reka-ui' +import { onBeforeUnmount, watch } from 'vue' import { useI18n } from 'vue-i18n' import Button from '@comfyorg/design-system/button/Button' @@ -66,13 +54,11 @@ import { } from '@/components/graph/selectionGrid/selectionGridLayout' import { useSelectionGrid } from '@/components/graph/selectionGrid/useSelectionGrid' import { useTidySession } from '@/components/graph/selectionGrid/useTidySession' - -const TOOLBOX_INSET = 4 -const BAR_GAP_BELOW_TOOLBOX = 8 -const BAR_INSET = 4 -const TRIGGER_HEIGHT = 32 -const BAR_SIDE_OFFSET = TOOLBOX_INSET + BAR_GAP_BELOW_TOOLBOX -const LIFT_WHILE_OPEN = BAR_SIDE_OFFSET + BAR_INSET + TRIGGER_HEIGHT +import SelectionToolboxBar from '@/components/graph/selectionToolbox/SelectionToolboxBar.vue' +import { + LIFT_WHILE_OPEN, + hasSameMembers +} from '@/components/graph/selectionToolbox/selectionToolboxBar' const { t } = useI18n() const { canTidy, gridNodes } = useSelectionGrid() @@ -80,7 +66,7 @@ const { gap, hasMixedGaps, handles, start, previewGap, commitGap, finish } = useTidySession() const lift = defineModel('lift', { default: 0 }) -const isOpen = ref(false) +const isOpen = defineModel('open', { default: false }) watch(isOpen, (open) => { lift.value = open ? LIFT_WHILE_OPEN : 0 @@ -88,34 +74,15 @@ watch(isOpen, (open) => { else finish() }) -const hasSameNodes = (nodes: T[], previous: T[]) => { - const previousNodes = new Set(previous) - return ( - nodes.length === previousNodes.size && - nodes.every((node) => previousNodes.has(node)) - ) -} - watch(gridNodes, (nodes, previous) => { - if (!hasSameNodes(nodes, previous)) isOpen.value = false + if (!hasSameMembers(nodes, previous)) isOpen.value = false }) onBeforeUnmount(() => { + isOpen.value = false lift.value = 0 }) -const keepOpenForToolboxAndHandles = ( - event: FocusOutsideEvent | PointerDownOutsideEvent -) => { - const { target } = event.detail.originalEvent - if ( - target instanceof Element && - target.closest('[data-selection-toolbox], [data-gap-handle]') - ) { - event.preventDefault() - } -} - const applySliderGap = ( value: number[] | undefined, apply: (gap: number) => void diff --git a/src/components/graph/selectionToolbox/selectionToolboxBar.ts b/src/components/graph/selectionToolbox/selectionToolboxBar.ts new file mode 100644 index 00000000000..8554c49a8a1 --- /dev/null +++ b/src/components/graph/selectionToolbox/selectionToolboxBar.ts @@ -0,0 +1,15 @@ +const TOOLBOX_INSET = 4 +const BAR_GAP_BELOW_TOOLBOX = 8 +const BAR_INSET = 4 +const TRIGGER_HEIGHT = 32 + +export const BAR_SIDE_OFFSET = TOOLBOX_INSET + BAR_GAP_BELOW_TOOLBOX +export const LIFT_WHILE_OPEN = BAR_SIDE_OFFSET + BAR_INSET + TRIGGER_HEIGHT + +export const hasSameMembers = (items: T[], previous: T[]) => { + const previousItems = new Set(previous) + return ( + items.length === previousItems.size && + items.every((item) => previousItems.has(item)) + ) +} diff --git a/src/composables/graph/contextMenuConverter.ts b/src/composables/graph/contextMenuConverter.ts index d5948936acc..0497db889b9 100644 --- a/src/composables/graph/contextMenuConverter.ts +++ b/src/composables/graph/contextMenuConverter.ts @@ -83,8 +83,7 @@ const CORE_MENU_ITEMS = new Set([ 'Copy (Clipspace)', 'Paste (Clipspace)', // Selection and alignment - 'Align Selected To', - 'Distribute Nodes', + 'Arrange', // Deletion 'Delete', 'Remove', diff --git a/src/composables/graph/menuOption.ts b/src/composables/graph/menuOption.ts index 56e978334e0..8aa660e1c68 100644 --- a/src/composables/graph/menuOption.ts +++ b/src/composables/graph/menuOption.ts @@ -5,7 +5,7 @@ export interface MenuOption { hasSubmenu?: boolean type?: 'divider' | 'category' action?: () => void - submenu?: SubMenuOption[] + submenu?: SubMenuItem[] badge?: BadgeVariant disabled?: boolean source?: 'litegraph' | 'vue' @@ -21,6 +21,15 @@ export interface SubMenuOption { disabled?: boolean } +interface SubMenuDivider { + type: 'divider' +} + +type SubMenuItem = SubMenuOption | SubMenuDivider + +export const isSubMenuOption = (item: SubMenuItem): item is SubMenuOption => + !('type' in item) + export enum BadgeVariant { NEW = 'new' } diff --git a/src/composables/graph/useGroupMenuOptions.test.ts b/src/composables/graph/useGroupMenuOptions.test.ts index 39caabb3b15..46d75df50af 100644 --- a/src/composables/graph/useGroupMenuOptions.test.ts +++ b/src/composables/graph/useGroupMenuOptions.test.ts @@ -3,6 +3,8 @@ import { defineComponent } from 'vue' import { createI18n } from 'vue-i18n' import { describe, expect, it, vi } from 'vitest' +import { isSubMenuOption } from '@/composables/graph/menuOption' +import type { SubMenuOption } from '@/composables/graph/menuOption' import { useGroupMenuOptions } from '@/composables/graph/useGroupMenuOptions' import { LGraphCanvas, LGraphGroup } from '@/lib/litegraph/src/litegraph' import { setCanvasSelection } from '@/utils/__tests__/canvasSelectionTestUtils' @@ -22,11 +24,13 @@ describe('useGroupMenuOptions.getGroupColorOptions', () => { const group = new LGraphGroup('Test Group') setCanvasSelection([group]) - let submenu: { label: string; action: () => void }[] = [] + let submenu: SubMenuOption[] = [] const Wrapper = defineComponent({ setup() { const { getGroupColorOptions } = useGroupMenuOptions() - submenu = getGroupColorOptions(group, () => {}).submenu ?? [] + submenu = (getGroupColorOptions(group, () => {}).submenu ?? []).filter( + isSubMenuOption + ) return () => null } }) diff --git a/src/composables/graph/useMoreOptionsMenu.ts b/src/composables/graph/useMoreOptionsMenu.ts index b1e7fd425aa..107b52e5010 100644 --- a/src/composables/graph/useMoreOptionsMenu.ts +++ b/src/composables/graph/useMoreOptionsMenu.ts @@ -133,7 +133,7 @@ export function useMoreOptionsMenu() { getBasicSelectionOptions, getMultipleNodesOptions, getSubgraphOptions, - getAlignmentOptions, + getArrangeOption, getDeleteOption } = useSelectionMenuOptions() @@ -147,11 +147,9 @@ export function useMoreOptionsMenu() { } const menuOptions = computed((): MenuOption[] => { - // Reference selection flags to ensure re-computation when they change void optionsVersion.value const states = computeSelectionFlags() - // Detect single group selection context (and no nodes explicitly selected) const selectedGroups = selectedItems.value.filter(isLGraphGroup) const groupContext: LGraphGroup | null = selectedGroups.length === 1 && selectedNodes.value.length === 0 @@ -159,14 +157,15 @@ export function useMoreOptionsMenu() { : null const hasSubgraphsSelected = hasSubgraphs.value - // For single node selection, also get LiteGraph menu items to merge const litegraphOptions: MenuOption[] = [] - const node: LGraphNode | undefined = - (invocationContext.value === undefined + const invokedNode = + invocationContext.value === undefined ? undefined - : canvasStore.currentGraph?.getNodeById( + : (canvasStore.currentGraph?.getNodeById( invocationContext.value.nodeId - )) ?? selectedNodes.value.at(0) + ) ?? undefined) + const node: LGraphNode | undefined = + invokedNode ?? selectedNodes.value.at(0) const hideLinkedInputActions = node ? shouldHideLinkedCoreMediaInputActions(node) : false @@ -187,7 +186,6 @@ export function useMoreOptionsMenu() { ) { try { const rawItems = canvasStore.canvas.getNodeMenuOptions(node) - // Don't apply structuring yet - we'll do it after merging with Vue options litegraphOptions.push( ...convertContextMenuToOptions( filterUnavailableCoreMediaMenuActions( @@ -205,12 +203,10 @@ export function useMoreOptionsMenu() { const options: MenuOption[] = [] - // Section 1: Basic selection operations (Rename, Copy, Duplicate) const basicOps = getBasicSelectionOptions() options.push(...basicOps) options.push({ type: 'divider' }) - // Section 2: Node actions (Run Branch, Pin, Bypass, Mute) if (hasOutputNodesSelected.value) { const runBranch = getRunBranchOption() options.push(runBranch) @@ -227,7 +223,6 @@ export function useMoreOptionsMenu() { } options.push({ type: 'divider' }) - // Section 3: Structure operations (Convert to Subgraph, Frame selection, Minimize Node) options.push( ...getSubgraphOptions({ hasSubgraphs: hasSubgraphsSelected, @@ -236,38 +231,34 @@ export function useMoreOptionsMenu() { ) if (hasMultipleNodes.value) { options.push(...getMultipleNodesOptions()) - options.push(...getAlignmentOptions(node)) + options.push(getArrangeOption(invokedNode)) } if (groupContext) { options.push(getFitGroupToNodesOption(groupContext)) } else { - // Node context: Expand/Minimize const visualOptions = getNodeVisualOptions(states, bump) if (visualOptions.length > 0) { - options.push(visualOptions[0]) // Expand/Minimize (index 0) + options.push(visualOptions[0]) } } options.push({ type: 'divider' }) - // Section 4: Node properties (Node Info, Shape, Color) if (canOpenNodeInfo.value) { options.push(getNodeInfoOption(openNodeInfo)) } if (groupContext) { options.push(getGroupColorOptions(groupContext, bump)) } else { - // Add shape and color options const visualOptions = getNodeVisualOptions(states, bump) if (visualOptions.length > 1) { - options.push(visualOptions[1]) // Shape (index 1) + options.push(visualOptions[1]) } if (visualOptions.length > 2) { - options.push(visualOptions[2]) // Color (index 2) + options.push(visualOptions[2]) } } options.push({ type: 'divider' }) - // Section 5: Image operations (image nodes, or a node with several outputs) if ( (hasImageNode.value && selectedNodes.value.length > 0) || (isSingleNode.value && hasMultipleOutputs(selectedNodes.value[0])) @@ -300,17 +291,12 @@ export function useMoreOptionsMenu() { ) ) - // Section 6 & 7: Extensions and Delete are handled by buildStructuredMenu - - // Mark all Vue options with source const markedVueOptions = markAsVueOptions(options) if (litegraphOptions.length > 0) { - // Merge: LiteGraph options first, then Vue options (Vue will win in dedup) const merged = [...litegraphOptions, ...markedVueOptions] return buildStructuredMenu(merged) } - // For other cases, structure the Vue options const result = buildStructuredMenu(markedVueOptions) return result }) diff --git a/src/composables/graph/useNodeArrangement.ts b/src/composables/graph/useNodeArrangement.ts index f0ef4889aab..f3a21316af7 100644 --- a/src/composables/graph/useNodeArrangement.ts +++ b/src/composables/graph/useNodeArrangement.ts @@ -1,3 +1,4 @@ +import { computed } from 'vue' import { useI18n } from 'vue-i18n' import type { Direction } from '@/lib/litegraph/src/interfaces' @@ -8,6 +9,8 @@ import { isLGraphNode } from '@/utils/litegraphUtil' import { useCanvasRefresh } from './useCanvasRefresh' +export const ARRANGE_ICON = 'icon-[lucide--align-start-vertical]' + interface AlignOption { name: string localizedName: string @@ -29,28 +32,33 @@ export function useNodeArrangement() { const { t } = useI18n() const canvasStore = useCanvasStore() const canvasRefresh = useCanvasRefresh() + const canArrange = computed( + () => + !canvasStore.isReadOnly && + canvasStore.selectedItems.filter(isLGraphNode).length >= 2 + ) const alignOptions: AlignOption[] = [ { name: 'top', - localizedName: t('contextMenu.Top'), + localizedName: t('contextMenu.Align top'), value: 'top', icon: 'icon-[lucide--align-start-horizontal]' }, { name: 'bottom', - localizedName: t('contextMenu.Bottom'), + localizedName: t('contextMenu.Align bottom'), value: 'bottom', icon: 'icon-[lucide--align-end-horizontal]' }, { name: 'left', - localizedName: t('contextMenu.Left'), + localizedName: t('contextMenu.Align left'), value: 'left', icon: 'icon-[lucide--align-start-vertical]' }, { name: 'right', - localizedName: t('contextMenu.Right'), + localizedName: t('contextMenu.Align right'), value: 'right', icon: 'icon-[lucide--align-end-vertical]' } @@ -59,13 +67,13 @@ export function useNodeArrangement() { const distributeOptions: DistributeOption[] = [ { name: 'horizontal', - localizedName: t('contextMenu.Horizontal'), + localizedName: t('contextMenu.Distribute horizontally'), value: true, icon: 'icon-[lucide--align-center-horizontal]' }, { name: 'vertical', - localizedName: t('contextMenu.Vertical'), + localizedName: t('contextMenu.Distribute vertically'), value: false, icon: 'icon-[lucide--align-center-vertical]' } @@ -101,6 +109,7 @@ export function useNodeArrangement() { } return { + canArrange, alignOptions, distributeOptions, applyAlign, diff --git a/src/composables/graph/useSelectionMenuOptions.test.ts b/src/composables/graph/useSelectionMenuOptions.test.ts index 4c003af529b..13fd9134243 100644 --- a/src/composables/graph/useSelectionMenuOptions.test.ts +++ b/src/composables/graph/useSelectionMenuOptions.test.ts @@ -3,13 +3,15 @@ import { defineComponent } from 'vue' import { createI18n } from 'vue-i18n' import { describe, expect, it, vi } from 'vitest' +import { isSubMenuOption } from '@/composables/graph/menuOption' import { useSelectionMenuOptions } from '@/composables/graph/useSelectionMenuOptions' const mocks = vi.hoisted(() => ({ convertToSubgraph: vi.fn(), unpackSubgraph: vi.fn(), addSubgraphToLibrary: vi.fn(), - frameNodes: vi.fn() + frameNodes: vi.fn(), + canArrange: { value: true } })) const i18n = createI18n({ @@ -30,7 +32,9 @@ vi.mock(import('@/composables/graph/useSelectionOperations'), () => ({ })) vi.mock(import('@/composables/graph/useNodeArrangement'), () => ({ + ARRANGE_ICON: 'arrange', useNodeArrangement: () => ({ + canArrange: mocks.canArrange, alignOptions: [{ localizedName: 'align-left', icon: 'align-left' }], distributeOptions: [{ localizedName: 'distribute', icon: 'distribute' }], applyAlign: vi.fn(), @@ -134,3 +138,37 @@ describe('useSelectionMenuOptions - subgraph options', () => { expect(addToLibraryOption?.action).toBe(mocks.addSubgraphToLibrary) }) }) + +describe('useSelectionMenuOptions - arrange option', () => { + it('puts Tidy up, the align options and the distribute options in one submenu', () => { + const { getArrangeOption } = setupComposable() + const option = getArrangeOption() + + expect(option.label).toBe('contextMenu.Arrange') + expect( + option.submenu?.map((item) => + isSubMenuOption(item) ? item.label : 'divider' + ) + ).toEqual(['g.tidyUp', 'divider', 'align-left', 'divider', 'distribute']) + }) + + it.for([ + { canArrange: true, disabled: false }, + { canArrange: false, disabled: true } + ])( + 'disables the align and distribute options: $disabled, when canArrange is $canArrange', + ({ canArrange, disabled }) => { + mocks.canArrange.value = canArrange + const { getArrangeOption } = setupComposable() + + const arrangeOptions = (getArrangeOption().submenu ?? []) + .filter(isSubMenuOption) + .filter((item) => item.label !== 'g.tidyUp') + expect(arrangeOptions.map((item) => Boolean(item.disabled))).toEqual([ + disabled, + disabled + ]) + mocks.canArrange.value = true + } + ) +}) diff --git a/src/composables/graph/useSelectionMenuOptions.ts b/src/composables/graph/useSelectionMenuOptions.ts index 219bcb190a9..92977ea05b8 100644 --- a/src/composables/graph/useSelectionMenuOptions.ts +++ b/src/composables/graph/useSelectionMenuOptions.ts @@ -6,7 +6,7 @@ import type { LGraphNode } from '@/lib/litegraph/src/litegraph' import { useFrameNodes } from './useFrameNodes' import { BadgeVariant } from './menuOption' import type { MenuOption } from './menuOption' -import { useNodeArrangement } from './useNodeArrangement' +import { ARRANGE_ICON, useNodeArrangement } from './useNodeArrangement' import { useSelectionOperations } from './useSelectionOperations' import { useSubgraphOperations } from './useSubgraphOperations' @@ -22,8 +22,13 @@ export function useSelectionMenuOptions() { renameSelection } = useSelectionOperations() - const { alignOptions, distributeOptions, applyAlign, applyDistribute } = - useNodeArrangement() + const { + canArrange, + alignOptions, + distributeOptions, + applyAlign, + applyDistribute + } = useNodeArrangement() const { convertToSubgraph, unpackSubgraph, addSubgraphToLibrary } = useSubgraphOperations() @@ -96,36 +101,34 @@ export function useSelectionMenuOptions() { } ] - const getAlignmentOptions = (alignTo?: LGraphNode): MenuOption[] => [ - { - label: t('contextMenu.Align Selected To'), - icon: 'icon-[lucide--align-start-horizontal]', - hasSubmenu: true, - submenu: alignOptions.map((align) => ({ + const getArrangeOption = (alignTo?: LGraphNode): MenuOption => ({ + label: t('contextMenu.Arrange'), + icon: ARRANGE_ICON, + hasSubmenu: true, + submenu: [ + { + label: t('g.tidyUp'), + icon: 'icon-[lucide--layout-dashboard]', + disabled: !canTidy.value, + action: () => tidyUp() + }, + { type: 'divider' }, + ...alignOptions.map((align) => ({ label: align.localizedName, icon: align.icon, + disabled: !canArrange.value, action: () => applyAlign(align, alignTo) })), - action: () => {} - }, - { - label: t('contextMenu.Distribute Nodes'), - icon: 'icon-[lucide--align-center-horizontal]', - hasSubmenu: true, - submenu: distributeOptions.map((distribute) => ({ + { type: 'divider' }, + ...distributeOptions.map((distribute) => ({ label: distribute.localizedName, icon: distribute.icon, + disabled: !canArrange.value, action: () => applyDistribute(distribute) - })), - action: () => {} - }, - { - label: t('g.tidyUp'), - icon: 'icon-[lucide--layout-dashboard]', - disabled: !canTidy.value, - action: () => tidyUp() - } - ] + })) + ], + action: () => {} + }) const getDeleteOption = (disabled: boolean): MenuOption => ({ label: t('contextMenu.Delete'), @@ -140,6 +143,6 @@ export function useSelectionMenuOptions() { getSubgraphOptions, getMultipleNodesOptions, getDeleteOption, - getAlignmentOptions + getArrangeOption } } diff --git a/src/locales/ar/main.json b/src/locales/ar/main.json index 1cd8b008c0e..55275cf4a69 100644 --- a/src/locales/ar/main.json +++ b/src/locales/ar/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "نسخ الصورة", "Delete": "حذف", "Distribute Nodes": "توزيع العقد", + "Arrange": "تنظيم", + "Align top": "محاذاة للأعلى", + "Align bottom": "محاذاة للأسفل", + "Align left": "محاذاة لليسار", + "Align right": "محاذاة لليمين", + "Distribute horizontally": "توزيع أفقي", + "Distribute vertically": "توزيع عمودي", "Download Images": "تنزيل الصور", "Duplicate": "تكرار", "Edit Subgraph Widgets": "تعديل عناصر الرسم البياني الفرعي", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "فشل تحميل النص", "tidyUp": "ترتيب", "tidyUpTooltip": "رتّب العقد في صفوف وأعمدة واجعل المسافات بينها متساوية", + "alignAndDistribute": "محاذاة وتوزيع", "title": "العنوان", "triggerPhrase": "عبارة التشغيل", "unknownError": "خطأ غير معروف", diff --git a/src/locales/de/main.json b/src/locales/de/main.json index 39bc19dd51b..2d81598a354 100644 --- a/src/locales/de/main.json +++ b/src/locales/de/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Bild kopieren", "Delete": "Löschen", "Distribute Nodes": "Nodes verteilen", + "Arrange": "Anordnen", + "Align top": "Oben ausrichten", + "Align bottom": "Unten ausrichten", + "Align left": "Links ausrichten", + "Align right": "Rechts ausrichten", + "Distribute horizontally": "Horizontal verteilen", + "Distribute vertically": "Vertikal verteilen", "Download Images": "Bilder herunterladen", "Duplicate": "Duplizieren", "Edit Subgraph Widgets": "Subgraph-Widgets bearbeiten", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "Text konnte nicht geladen werden", "tidyUp": "Aufräumen", "tidyUpTooltip": "Knoten in Zeilen und Spalten ausrichten und Abstände angleichen", + "alignAndDistribute": "Ausrichten und verteilen", "title": "Titel", "triggerPhrase": "Auslösephrase", "unknownError": "Unbekannter Fehler", diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 8cbb5dff5b1..e65ab413b5a 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -405,6 +405,7 @@ "frameNodes": "Frame Nodes", "tidyUp": "Tidy up", "tidyUpTooltip": "Line the nodes up in rows and columns and even out the gaps", + "alignAndDistribute": "Align and distribute", "gapHandle": "Gap between nodes", "gapValue": "{value} canvas unit | {value} canvas units", "mixedGaps": "Mixed", @@ -729,6 +730,13 @@ "Convert to Subgraph": "Convert to Subgraph", "Align Selected To": "Align Selected To", "Distribute Nodes": "Distribute Nodes", + "Arrange": "Arrange", + "Align top": "Align top", + "Align bottom": "Align bottom", + "Align left": "Align left", + "Align right": "Align right", + "Distribute horizontally": "Distribute horizontally", + "Distribute vertically": "Distribute vertically", "Remove Bypass": "Remove Bypass", "Run Branch": "Run Branch", "Delete": "Delete", diff --git a/src/locales/es/main.json b/src/locales/es/main.json index 8326f3947f7..e07d41d5286 100644 --- a/src/locales/es/main.json +++ b/src/locales/es/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Copiar Imagen", "Delete": "Eliminar", "Distribute Nodes": "Distribuir Nodos", + "Arrange": "Disponer", + "Align top": "Alinear arriba", + "Align bottom": "Alinear abajo", + "Align left": "Alinear a la izquierda", + "Align right": "Alinear a la derecha", + "Distribute horizontally": "Distribuir horizontalmente", + "Distribute vertically": "Distribuir verticalmente", "Download Images": "Descargar imágenes", "Duplicate": "Duplicar", "Edit Subgraph Widgets": "Editar Widgets de Subgrafo", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "No se pudo cargar el texto", "tidyUp": "Ordenar", "tidyUpTooltip": "Alinea los nodos en filas y columnas e iguala los espacios", + "alignAndDistribute": "Alinear y distribuir", "title": "Título", "triggerPhrase": "Frase de activación", "unknownError": "Error desconocido", diff --git a/src/locales/fa/main.json b/src/locales/fa/main.json index c8e49201693..2773cac3898 100644 --- a/src/locales/fa/main.json +++ b/src/locales/fa/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "کپی تصویر", "Delete": "حذف", "Distribute Nodes": "توزیع Nodeها", + "Arrange": "چیدمان", + "Align top": "تراز بالا", + "Align bottom": "تراز پایین", + "Align left": "تراز چپ", + "Align right": "تراز راست", + "Distribute horizontally": "توزیع افقی", + "Distribute vertically": "توزیع عمودی", "Download Images": "دانلود تصاویر", "Duplicate": "تکرار", "Edit Subgraph Widgets": "ویرایش ویجت‌های Subgraph", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "بارگذاری متن ناموفق بود", "tidyUp": "مرتب‌سازی", "tidyUpTooltip": "گره‌ها را در ردیف‌ها و ستون‌ها مرتب کنید و فاصله‌ها را یکسان کنید", + "alignAndDistribute": "تراز و توزیع", "title": "عنوان", "triggerPhrase": "عبارت trigger", "unknownError": "خطای ناشناخته", diff --git a/src/locales/fr/main.json b/src/locales/fr/main.json index fefdd329267..f18b8b0fb51 100644 --- a/src/locales/fr/main.json +++ b/src/locales/fr/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Copier l'image", "Delete": "Supprimer", "Distribute Nodes": "Répartir les nœuds", + "Arrange": "Disposer", + "Align top": "Aligner en haut", + "Align bottom": "Aligner en bas", + "Align left": "Aligner à gauche", + "Align right": "Aligner à droite", + "Distribute horizontally": "Répartir horizontalement", + "Distribute vertically": "Répartir verticalement", "Download Images": "Télécharger les images", "Duplicate": "Dupliquer", "Edit Subgraph Widgets": "Modifier les widgets du sous-graphe", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "Échec du chargement du texte", "tidyUp": "Ranger", "tidyUpTooltip": "Aligner les nœuds en lignes et en colonnes et égaliser les espacements", + "alignAndDistribute": "Aligner et répartir", "title": "Titre", "triggerPhrase": "Phrase déclencheuse", "unknownError": "Erreur inconnue", diff --git a/src/locales/he/main.json b/src/locales/he/main.json index a3320e29320..b542be43deb 100644 --- a/src/locales/he/main.json +++ b/src/locales/he/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "העתקת תמונה", "Delete": "מחיקה", "Distribute Nodes": "פיזור הצמתים", + "Arrange": "פריסה", + "Align top": "יישור למעלה", + "Align bottom": "יישור למטה", + "Align left": "יישור לשמאל", + "Align right": "יישור לימין", + "Distribute horizontally": "פיזור אופקי", + "Distribute vertically": "פיזור אנכי", "Download Images": "הורדת תמונות", "Duplicate": "שכפול", "Edit Subgraph Widgets": "עריכת פקדי תת-הגרף", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "טעינת הטקסט נכשלה", "tidyUp": "סידור", "tidyUpTooltip": "יישר את הצמתים בשורות ובעמודות והשווה את המרווחים", + "alignAndDistribute": "יישור ופיזור", "title": "כותרת", "triggerPhrase": "ביטוי הפעלה", "unknownError": "שגיאה לא ידועה", diff --git a/src/locales/it/main.json b/src/locales/it/main.json index 5bb2c175d3d..950ab843343 100644 --- a/src/locales/it/main.json +++ b/src/locales/it/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Copia immagine", "Delete": "Elimina", "Distribute Nodes": "Distribuisci nodi", + "Arrange": "Disponi", + "Align top": "Allinea in alto", + "Align bottom": "Allinea in basso", + "Align left": "Allinea a sinistra", + "Align right": "Allinea a destra", + "Distribute horizontally": "Distribuisci orizzontalmente", + "Distribute vertically": "Distribuisci verticalmente", "Download Images": "Scarica immagini", "Duplicate": "Duplica", "Edit Subgraph Widgets": "Modifica widget del sottografo", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "Impossibile caricare il testo", "tidyUp": "Riordina", "tidyUpTooltip": "Allinea i nodi in righe e colonne e uniforma gli spazi", + "alignAndDistribute": "Allinea e distribuisci", "title": "Titolo", "triggerPhrase": "Frase di attivazione", "unknownError": "Errore sconosciuto", diff --git a/src/locales/ja/main.json b/src/locales/ja/main.json index 5de0c5b038d..5c58374ff05 100644 --- a/src/locales/ja/main.json +++ b/src/locales/ja/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "画像をコピー", "Delete": "削除", "Distribute Nodes": "ノードを分布", + "Arrange": "配置", + "Align top": "上揃え", + "Align bottom": "下揃え", + "Align left": "左揃え", + "Align right": "右揃え", + "Distribute horizontally": "水平方向に分布", + "Distribute vertically": "垂直方向に分布", "Download Images": "画像をダウンロード", "Duplicate": "複製", "Edit Subgraph Widgets": "サブグラフウィジェットを編集", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "テキストの読み込みに失敗しました", "tidyUp": "整列", "tidyUpTooltip": "ノードを行と列にそろえ、間隔を均等にします", + "alignAndDistribute": "揃え・分布", "title": "タイトル", "triggerPhrase": "トリガーフレーズ", "unknownError": "不明なエラー", diff --git a/src/locales/ko/main.json b/src/locales/ko/main.json index 526ba63e72f..ca68fd0d398 100644 --- a/src/locales/ko/main.json +++ b/src/locales/ko/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "이미지 복사", "Delete": "삭제", "Distribute Nodes": "노드 배치", + "Arrange": "배열", + "Align top": "위쪽 맞춤", + "Align bottom": "아래쪽 맞춤", + "Align left": "왼쪽 맞춤", + "Align right": "오른쪽 맞춤", + "Distribute horizontally": "가로로 분산", + "Distribute vertically": "세로로 분산", "Download Images": "이미지 다운로드", "Duplicate": "복제", "Edit Subgraph Widgets": "서브그래프 위젯 편집", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "텍스트를 불러오지 못했습니다", "tidyUp": "정리", "tidyUpTooltip": "노드를 행과 열로 정렬하고 간격을 고르게 맞춥니다", + "alignAndDistribute": "맞춤 및 분산", "title": "제목", "triggerPhrase": "트리거 문구", "unknownError": "알 수 없는 오류", diff --git a/src/locales/pt-BR/main.json b/src/locales/pt-BR/main.json index 486048e23a5..7ad7c7cd3b8 100644 --- a/src/locales/pt-BR/main.json +++ b/src/locales/pt-BR/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Copiar Imagem", "Delete": "Excluir", "Distribute Nodes": "Distribuir Nós", + "Arrange": "Dispor", + "Align top": "Alinhar ao topo", + "Align bottom": "Alinhar embaixo", + "Align left": "Alinhar à esquerda", + "Align right": "Alinhar à direita", + "Distribute horizontally": "Distribuir horizontalmente", + "Distribute vertically": "Distribuir verticalmente", "Download Images": "Baixar imagens", "Duplicate": "Duplicar", "Edit Subgraph Widgets": "Editar Widgets do Subgrafo", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "Falha ao carregar o texto", "tidyUp": "Organizar", "tidyUpTooltip": "Alinhe os nós em linhas e colunas e iguale os espaçamentos", + "alignAndDistribute": "Alinhar e distribuir", "title": "Título", "triggerPhrase": "Frase de gatilho", "unknownError": "Erro desconhecido", diff --git a/src/locales/ru/main.json b/src/locales/ru/main.json index ba17367dccb..6a71995e3b2 100644 --- a/src/locales/ru/main.json +++ b/src/locales/ru/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Копировать изображение", "Delete": "Удалить", "Distribute Nodes": "Распределить ноды", + "Arrange": "Расположение", + "Align top": "Выровнять по верху", + "Align bottom": "Выровнять по низу", + "Align left": "Выровнять по левому краю", + "Align right": "Выровнять по правому краю", + "Distribute horizontally": "Распределить по горизонтали", + "Distribute vertically": "Распределить по вертикали", "Download Images": "Скачать изображения", "Duplicate": "Дублировать", "Edit Subgraph Widgets": "Редактировать виджеты подграфа", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "Не удалось загрузить текст", "tidyUp": "Упорядочить", "tidyUpTooltip": "Выровнять узлы по строкам и столбцам и сделать промежутки равными", + "alignAndDistribute": "Выравнивание и распределение", "title": "Заголовок", "triggerPhrase": "Триггерная фраза", "unknownError": "Неизвестная ошибка", diff --git a/src/locales/tr/main.json b/src/locales/tr/main.json index 74301c45dff..07004df6ec8 100644 --- a/src/locales/tr/main.json +++ b/src/locales/tr/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "Görüntüyü Kopyala", "Delete": "Sil", "Distribute Nodes": "Düğümleri Dağıt", + "Arrange": "Yerleştir", + "Align top": "Üste hizala", + "Align bottom": "Alta hizala", + "Align left": "Sola hizala", + "Align right": "Sağa hizala", + "Distribute horizontally": "Yatay dağıt", + "Distribute vertically": "Dikey dağıt", "Download Images": "Görüntüleri İndir", "Duplicate": "Çoğalt", "Edit Subgraph Widgets": "Alt Grafik Widget'larını Düzenle", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "Metin yüklenemedi", "tidyUp": "Düzenle", "tidyUpTooltip": "Düğümleri satır ve sütunlara hizala ve boşlukları eşitle", + "alignAndDistribute": "Hizala ve dağıt", "title": "Başlık", "triggerPhrase": "Tetikleyici ifade", "unknownError": "Bilinmeyen hata", diff --git a/src/locales/zh-TW/main.json b/src/locales/zh-TW/main.json index 71b591c8c96..b3b9794bad7 100644 --- a/src/locales/zh-TW/main.json +++ b/src/locales/zh-TW/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "複製圖片", "Delete": "刪除", "Distribute Nodes": "分佈節點", + "Arrange": "排列", + "Align top": "頂部對齊", + "Align bottom": "底部對齊", + "Align left": "靠左對齊", + "Align right": "靠右對齊", + "Distribute horizontally": "水平分佈", + "Distribute vertically": "垂直分佈", "Download Images": "下載圖片", "Duplicate": "複製", "Edit Subgraph Widgets": "編輯子圖小工具", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "文字載入失敗", "tidyUp": "整理", "tidyUpTooltip": "將節點按列與欄對齊,並使間距平均", + "alignAndDistribute": "對齊與分佈", "title": "標題", "triggerPhrase": "觸發詞", "unknownError": "未知錯誤", diff --git a/src/locales/zh/main.json b/src/locales/zh/main.json index f9920860498..f5903b114ce 100644 --- a/src/locales/zh/main.json +++ b/src/locales/zh/main.json @@ -1145,6 +1145,13 @@ "Copy Image": "复制图像", "Delete": "删除", "Distribute Nodes": "分布节点", + "Arrange": "排列", + "Align top": "顶部对齐", + "Align bottom": "底部对齐", + "Align left": "左对齐", + "Align right": "右对齐", + "Distribute horizontally": "水平分布", + "Distribute vertically": "垂直分布", "Download Images": "下载图像", "Duplicate": "复制", "Edit Subgraph Widgets": "编辑子工作流组件", @@ -2444,6 +2451,7 @@ "textFailedToLoad": "文本加载失败", "tidyUp": "整理", "tidyUpTooltip": "将节点按行和列对齐,并使间距均匀", + "alignAndDistribute": "对齐与分布", "title": "标题", "triggerPhrase": "触发短语", "unknownError": "未知错误",