Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fit view to bounds #1474

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/litegraph": "^0.8.23",
"@comfyorg/litegraph": "^0.8.24",
"@primevue/themes": "^4.0.5",
"@vueuse/core": "^11.0.0",
"axios": "^1.7.4",
Expand Down
4 changes: 2 additions & 2 deletions src/components/graph/GraphCanvasMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<Button
severity="secondary"
icon="pi pi-expand"
v-tooltip.left="t('graphCanvasMenu.resetView')"
@click="() => commandStore.execute('Comfy.Canvas.ResetView')"
v-tooltip.left="t('graphCanvasMenu.fitView')"
@click="() => commandStore.execute('Comfy.Canvas.FitView')"
/>
<Button
severity="secondary"
Expand Down
3 changes: 3 additions & 0 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const messages = {
zoomIn: 'Zoom In',
zoomOut: 'Zoom Out',
resetView: 'Reset View',
fitView: 'Fit View',
selectMode: 'Select Mode',
panMode: 'Pan Mode',
toggleLinkVisibility: 'Toggle Link Visibility'
Expand Down Expand Up @@ -233,6 +234,7 @@ const messages = {
zoomIn: '放大',
zoomOut: '缩小',
resetView: '重置视图',
fitView: '适应视图',
selectMode: '选择模式',
panMode: '平移模式',
toggleLinkVisibility: '切换链接可见性'
Expand Down Expand Up @@ -352,6 +354,7 @@ const messages = {
zoomIn: 'Увеличить',
zoomOut: 'Уменьшить',
resetView: 'Сбросить вид',
fitView: 'Подгонять под выделенные',
selectMode: 'Выбрать режим',
panMode: 'Режим панорамирования',
toggleLinkVisibility: 'Переключить видимость ссылок'
Expand Down
1 change: 1 addition & 0 deletions src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ComfyAppMenu } from './ui/menu/index'
import { getStorageValue } from './utils'
import { ComfyWorkflow } from '@/stores/workflowStore'
import {
LGraphGroup,
LGraphCanvas,
LGraph,
LGraphNode,
Expand Down
6 changes: 6 additions & 0 deletions src/stores/commandStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ export const useCommandStore = defineStore('command', () => {
app.canvas.setDirty(true, true)
}
},
{
id: 'Comfy.Canvas.FitView',
icon: 'pi pi-expand',
label: 'Fit view to selected nodes',
function: () => app.canvas.fitViewToSelectionAnimated()
},
{
id: 'Comfy.Canvas.ToggleLock',
icon: 'pi pi-lock',
Expand Down
7 changes: 7 additions & 0 deletions src/stores/coreKeybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
commandId: 'Comfy.Canvas.ZoomOut',
targetSelector: '#graph-canvas'
},
{
combo: {
key: '.'
},
commandId: 'Comfy.Canvas.FitView',
targetSelector: '#graph-canvas'
},
{
combo: {
key: 'p'
Expand Down
Loading