-
Notifications
You must be signed in to change notification settings - Fork 376
Refactor vue slot tracking #5463
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
3112dba
add dom element resize observer registry for vue node components
christian-byrne b6269c0
Update src/renderer/extensions/vueNodes/composables/useVueNodeResizeT…
christian-byrne 4287526
refactor(vue-nodes): typed TransformState InjectionKey, safer ResizeO…
benceruleanlu 110ecf3
chore: make TransformState interface non-exported to satisfy knip pre…
benceruleanlu 9786ecf
Revert "chore: make TransformState interface non-exported to satisfy …
benceruleanlu dbacbc5
Revert "refactor(vue-nodes): typed TransformState InjectionKey, safer…
benceruleanlu d4c2e83
[refactor] Improve resize tracking composable documentation and test …
christian-byrne db5a68b
remove typo comment
christian-byrne c39cdaf
convert to functional bounds collection
christian-byrne d39bf36
remove inline import
christian-byrne ea93135
add interfaces for bounds mutations
christian-byrne ea9c121
remove change log
christian-byrne ed94827
fix bounds collection when vue nodes turned off
christian-byrne ffede77
fix title offset on y
christian-byrne 5022f14
move from resize observer to selection toolbox bounds
christian-byrne f63118b
refactor(vue-nodes): typed TransformState InjectionKey, safer ResizeO…
benceruleanlu cb2069c
Fix conversion
benceruleanlu a0ed9d9
Readd padding
benceruleanlu 3a7cc3f
revert churn reducings from layoutStore.ts
benceruleanlu 0ba660f
Rely on RO for resize, and batch
benceruleanlu ed7a4e9
Improve churn
benceruleanlu 121221d
Cache canvas offset
benceruleanlu 4de2c2f
Merge remote-tracking branch 'origin/main' into bl-update-slots
benceruleanlu 57a1359
rename from measure
benceruleanlu cb211eb
Merge remote-tracking branch 'origin/main' into bl-update-slots
benceruleanlu 1dfa72c
remove unused
benceruleanlu 69f5391
address review comments
benceruleanlu 9203ed5
Merge remote-tracking branch 'origin/main' into bl-update-slots
benceruleanlu 7d657a2
Update legacy injection
benceruleanlu a86cd97
nit
benceruleanlu 98a259d
Split into store
benceruleanlu fc3d609
nit
benceruleanlu 04c4c54
perf improvement
benceruleanlu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type { InjectionKey } from 'vue' | ||
|
||
import type { Point } from '@/renderer/core/layout/types' | ||
|
||
/** | ||
* Lightweight, injectable transform state used by layout-aware components. | ||
* | ||
* Consumers use this interface to convert coordinates between LiteGraph's | ||
* canvas space and the DOM's screen space, access the current pan/zoom | ||
* (camera), and perform basic viewport culling checks. | ||
* | ||
* Coordinate mapping: | ||
* - screen = (canvas + offset) * scale | ||
* - canvas = screen / scale - offset | ||
* | ||
* The full implementation and additional helpers live in | ||
* `useTransformState()`. This interface deliberately exposes only the | ||
* minimal surface needed outside that composable. | ||
* | ||
* @example | ||
* const state = inject(TransformStateKey)! | ||
* const screen = state.canvasToScreen({ x: 100, y: 50 }) | ||
*/ | ||
interface TransformState { | ||
benceruleanlu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/** Convert a screen-space point (CSS pixels) to canvas space. */ | ||
screenToCanvas: (p: Point) => Point | ||
/** Convert a canvas-space point to screen space (CSS pixels). */ | ||
canvasToScreen: (p: Point) => Point | ||
/** Current pan/zoom; `x`/`y` are offsets, `z` is scale. */ | ||
camera?: { x: number; y: number; z: number } | ||
/** | ||
* Test whether a node's rectangle intersects the (expanded) viewport. | ||
* Handy for viewport culling and lazy work. | ||
* | ||
* @param nodePos Top-left in canvas space `[x, y]` | ||
* @param nodeSize Size in canvas units `[width, height]` | ||
* @param viewport Screen-space viewport `{ width, height }` | ||
* @param margin Optional fractional margin (e.g. `0.2` = 20%) | ||
*/ | ||
isNodeInViewport?: ( | ||
nodePos: ArrayLike<number>, | ||
nodeSize: ArrayLike<number>, | ||
viewport: { width: number; height: number }, | ||
margin?: number | ||
) => boolean | ||
} | ||
|
||
export const TransformStateKey: InjectionKey<TransformState> = | ||
Symbol('transformState') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.