mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-11 10:30:10 +00:00
## Summary This PR redesigns the graph canvas interface components including minimap, toolbox, and menu systems with updated spacing, colors, and interaction patterns - using the design tokens directly from Figma, which can be used elsewhere going forward. There are some other changes to the designs, outlined [here](https://www.notion.so/comfy-org/Update-Minimap-Menu-v2-2886d73d365080e88e12f8df027019c0): - [x] Update/standardize the padding between viewport and toolbox - [x] Update toolbox component’s style to match the other floating menus style (border radius, height, padding and follow theme colors) - [x] Expose the minimap button - [x] Remove the focus button and delete it’s keybinding - [x] Group the hand and the default cursor buttons https://github.com/user-attachments/assets/92542e60-c32d-4a21-a6f6-e72837a70b17 ## Review Focus New CSS variables for cross-component theming consistency and CanvasModeSelector component extraction for improved code organization. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6038-rework-minimap-toolbox-and-menu-designs-with-unified-theming-28b6d73d36508191a0c6cf8036d965c4) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
166 lines
5.8 KiB
Vue
166 lines
5.8 KiB
Vue
<template>
|
|
<div
|
|
ref="toolboxRef"
|
|
style="transform: translate(var(--tb-x), var(--tb-y))"
|
|
class="pointer-events-none fixed top-0 left-0 z-40"
|
|
>
|
|
<Transition name="slide-up">
|
|
<Panel
|
|
v-if="visible"
|
|
class="selection-toolbox pointer-events-auto rounded-lg border border-interface-stroke bg-interface-panel-surface"
|
|
:pt="{
|
|
header: 'hidden',
|
|
content: 'p-2 h-12 flex flex-row gap-1'
|
|
}"
|
|
@wheel="canvasInteractions.forwardEventToCanvas"
|
|
>
|
|
<DeleteButton v-if="showDelete" />
|
|
<VerticalDivider v-if="showInfoButton && showAnyPrimaryActions" />
|
|
<InfoButton v-if="showInfoButton" />
|
|
|
|
<ColorPickerButton v-if="showColorPicker" />
|
|
<FrameNodes v-if="showFrameNodes" />
|
|
<ConvertToSubgraphButton v-if="showConvertToSubgraph" />
|
|
<ConfigureSubgraph v-if="showSubgraphButtons" />
|
|
<PublishSubgraphButton v-if="showSubgraphButtons" />
|
|
<MaskEditorButton v-if="showMaskEditor" />
|
|
<VerticalDivider
|
|
v-if="showAnyPrimaryActions && showAnyControlActions"
|
|
/>
|
|
|
|
<BypassButton v-if="showBypass" />
|
|
<RefreshSelectionButton v-if="showRefresh" />
|
|
<Load3DViewerButton v-if="showLoad3DViewer" />
|
|
|
|
<ExtensionCommandButton
|
|
v-for="command in extensionToolboxCommands"
|
|
:key="command.id"
|
|
:command="command"
|
|
/>
|
|
<ExecuteButton v-if="showExecute" />
|
|
<NodeOptionsButton />
|
|
</Panel>
|
|
</Transition>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Panel from 'primevue/panel'
|
|
import { computed, ref } from 'vue'
|
|
|
|
import BypassButton from '@/components/graph/selectionToolbox/BypassButton.vue'
|
|
import ColorPickerButton from '@/components/graph/selectionToolbox/ColorPickerButton.vue'
|
|
import ConfigureSubgraph from '@/components/graph/selectionToolbox/ConfigureSubgraph.vue'
|
|
import ConvertToSubgraphButton from '@/components/graph/selectionToolbox/ConvertToSubgraphButton.vue'
|
|
import DeleteButton from '@/components/graph/selectionToolbox/DeleteButton.vue'
|
|
import ExecuteButton from '@/components/graph/selectionToolbox/ExecuteButton.vue'
|
|
import ExtensionCommandButton from '@/components/graph/selectionToolbox/ExtensionCommandButton.vue'
|
|
import InfoButton from '@/components/graph/selectionToolbox/InfoButton.vue'
|
|
import Load3DViewerButton from '@/components/graph/selectionToolbox/Load3DViewerButton.vue'
|
|
import MaskEditorButton from '@/components/graph/selectionToolbox/MaskEditorButton.vue'
|
|
import RefreshSelectionButton from '@/components/graph/selectionToolbox/RefreshSelectionButton.vue'
|
|
import PublishSubgraphButton from '@/components/graph/selectionToolbox/SaveToSubgraphLibrary.vue'
|
|
import { useSelectionToolboxPosition } from '@/composables/canvas/useSelectionToolboxPosition'
|
|
import { useSelectionState } from '@/composables/graph/useSelectionState'
|
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions'
|
|
import { useExtensionService } from '@/services/extensionService'
|
|
import { useCommandStore } from '@/stores/commandStore'
|
|
import type { ComfyCommandImpl } from '@/stores/commandStore'
|
|
|
|
import FrameNodes from './selectionToolbox/FrameNodes.vue'
|
|
import NodeOptionsButton from './selectionToolbox/NodeOptionsButton.vue'
|
|
import VerticalDivider from './selectionToolbox/VerticalDivider.vue'
|
|
|
|
const commandStore = useCommandStore()
|
|
const canvasStore = useCanvasStore()
|
|
const extensionService = useExtensionService()
|
|
const canvasInteractions = useCanvasInteractions()
|
|
|
|
const toolboxRef = ref<HTMLElement | undefined>()
|
|
const { visible } = useSelectionToolboxPosition(toolboxRef)
|
|
|
|
const extensionToolboxCommands = computed<ComfyCommandImpl[]>(() => {
|
|
const commandIds = new Set<string>(
|
|
canvasStore.selectedItems
|
|
.map(
|
|
(item) =>
|
|
extensionService
|
|
.invokeExtensions('getSelectionToolboxCommands', item)
|
|
.flat() as string[]
|
|
)
|
|
.flat()
|
|
)
|
|
return Array.from(commandIds)
|
|
.map((commandId) => commandStore.getCommand(commandId))
|
|
.filter((command): command is ComfyCommandImpl => command !== undefined)
|
|
})
|
|
|
|
const {
|
|
hasAnySelection,
|
|
hasMultipleSelection,
|
|
isSingleNode,
|
|
isSingleSubgraph,
|
|
isSingleImageNode,
|
|
hasAny3DNodeSelected,
|
|
hasOutputNodesSelected,
|
|
nodeDef
|
|
} = useSelectionState()
|
|
const showInfoButton = computed(() => !!nodeDef.value)
|
|
|
|
const showColorPicker = computed(() => hasAnySelection.value)
|
|
const showConvertToSubgraph = computed(() => hasAnySelection.value)
|
|
const showFrameNodes = computed(() => hasMultipleSelection.value)
|
|
const showSubgraphButtons = computed(() => isSingleSubgraph.value)
|
|
|
|
const showBypass = computed(
|
|
() =>
|
|
isSingleNode.value || isSingleSubgraph.value || hasMultipleSelection.value
|
|
)
|
|
const showLoad3DViewer = computed(() => hasAny3DNodeSelected.value)
|
|
const showMaskEditor = computed(() => isSingleImageNode.value)
|
|
|
|
const showDelete = computed(() => hasAnySelection.value)
|
|
const showRefresh = computed(() => hasAnySelection.value)
|
|
const showExecute = computed(() => hasOutputNodesSelected.value)
|
|
|
|
const showAnyPrimaryActions = computed(
|
|
() =>
|
|
showColorPicker.value ||
|
|
showConvertToSubgraph.value ||
|
|
showFrameNodes.value ||
|
|
showSubgraphButtons.value
|
|
)
|
|
|
|
const showAnyControlActions = computed(() => showBypass.value)
|
|
</script>
|
|
|
|
<style scoped>
|
|
.selection-toolbox {
|
|
transform: translateX(-50%) translateY(-120%);
|
|
}
|
|
|
|
@keyframes slideUp {
|
|
0% {
|
|
transform: translateX(-50%) translateY(-100%);
|
|
opacity: 0;
|
|
}
|
|
50% {
|
|
transform: translateX(-50%) translateY(-125%);
|
|
opacity: 0.5;
|
|
}
|
|
100% {
|
|
transform: translateX(-50%) translateY(-120%);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.slide-up-enter-active {
|
|
animation: slideUp 125ms ease-out;
|
|
}
|
|
|
|
.slide-up-leave-active {
|
|
animation: slideUp 25ms ease-out reverse;
|
|
}
|
|
</style>
|