-
Notifications
You must be signed in to change notification settings - Fork 374
Layoutstore Minimap calculation #5547
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
Conversation
…on and viewport calculations
…d enhance type definitions
🎭 Playwright Test Results⏰ Completed at: 09/19/2025, 07:40:42 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phenomenal
} | ||
|
||
// TODO: update when Layoutstore tracks links | ||
const currentLinks = JSON.stringify(g.links || {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this could probably be devolved into a chain of computed()
s, since a lot of these are check/mutate on refs (or mutable state that isn't reactive)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my main concern too. stringify
is very expensive if we are repeatedly calling it.
Can we safely do this without stringifying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can handle it in a followup since this came from existing implementation that is just being refactored here.
src/renderer/extensions/minimap/composables/useMinimapViewport.ts
Outdated
Show resolved
Hide resolved
* Abstract base class for minimap data sources | ||
* Provides common functionality and shared implementation | ||
*/ | ||
export abstract class AbstractMinimapDataSource implements IMinimapDataSource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels really heavy for what it is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good considering we will have graph data from different sources. It should be nice as we make changes to data model and providers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got one comment
} | ||
|
||
// TODO: update when Layoutstore tracks links | ||
const currentLinks = JSON.stringify(g.links || {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my main concern too. stringify
is very expensive if we are repeatedly calling it.
Can we safely do this without stringifying?
I just copy pasted the existing implementation and tried to separate a layout store implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Can address review comments about optimizations and expressiveness in followup, thanks for implementing this.
This pull request refactors the minimap rendering system to use a unified, extensible data source abstraction for all minimap operations. By introducing a data source interface and factory, the minimap can now seamlessly support multiple sources of node layout (such as the
LayoutStore
or the underlyingLiteGraph
), improving maintainability and future extensibility. Rendering logic and change detection throughout the minimap have been updated to use this new abstraction, resulting in cleaner code and easier support for new data models.Core architecture improvements:
IMinimapDataSource
interface and related data types (MinimapNodeData
,MinimapLinkData
,MinimapGroupData
) to standardize node, link, and group data for minimap rendering.AbstractMinimapDataSource
that provides shared logic for bounds and group/link extraction, and implemented two concrete data sources:LiteGraphDataSource
(for classic graph data) andLayoutStoreDataSource
(for layout store data). [1] [2] [3]MinimapDataSourceFactory
that selects the appropriate data source based on the presence of layout store data, enabling seamless switching between data models.Minimap rendering and logic refactoring:
renderGroups
,renderNodes
,renderConnections
) and the mainrenderMinimapToCanvas
entry point to use the unified data source interface, significantly simplifying the rendering code and decoupling it from the underlying graph structure. [1] [2] [3] [4] [5] [6] [7] [8]These changes make the minimap codebase more modular and robust, and lay the groundwork for supporting additional node layout strategies in the future.
┆Issue is synchronized with this Notion page by Unito