App mode - store - 1 (#9022)

## Summary

Adds a store to control the mode the app is in (app, graph, builder)
Changes the existing linearMode in canvasStore to update new store

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9022-App-mode-store-1-30d6d73d365081498df1c1192c9860f0)
by [Unito](https://www.unito.io)
This commit is contained in:
pythongosssss
2026-02-23 10:10:58 +00:00
committed by GitHub
parent dd8520020e
commit d6c902187d
2 changed files with 48 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ import { defineStore } from 'pinia'
import { computed, markRaw, ref, shallowRef } from 'vue'
import type { Raw } from 'vue'
import { useAppModeStore } from '@/stores/appModeStore'
import type { Point, Positionable } from '@/lib/litegraph/src/interfaces'
import type {
LGraph,
@@ -40,7 +42,12 @@ export const useCanvasStore = defineStore('canvas', () => {
// Reactive scale percentage that syncs with app.canvas.ds.scale
const appScalePercentage = ref(100)
const linearMode = ref(false)
const linearMode = computed({
get: () => useAppModeStore().isAppMode,
set: (val: boolean) => {
useAppModeStore().setMode(val ? 'app' : 'graph')
}
})
// Set up scale synchronization when canvas is available
let originalOnChanged: ((scale: number, offset: Point) => void) | undefined =