mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-12 00:20:15 +00:00
* fix z-index on selection for vue nodes * fix unused export * refactor to DDD * Use Tailwind utility for pointer events instead of inline style Move pointer-events: auto from inline style to Tailwind class pointer-events-auto as suggested in PR review. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Rename defaultSource to layoutSource parameter Rename parameter in useNodeZIndex options interface for better clarity as suggested in PR review. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Improve test mocking pattern with vi.mocked approach Replace global mock object with per-test vi.mocked pattern and proper Partial typing instead of as any, as suggested in PR review. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [auto-fix] Apply ESLint and Prettier fixes --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: GitHub Action <action@github.com>
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
/**
|
|
* Node Z-Index Management Composable
|
|
*
|
|
* Provides focused functionality for managing node layering through z-index.
|
|
* Integrates with the layout system to ensure proper visual ordering.
|
|
*/
|
|
import { useLayoutMutations } from '@/renderer/core/layout/operations/layoutMutations'
|
|
import { LayoutSource } from '@/renderer/core/layout/types'
|
|
import type { NodeId } from '@/schemas/comfyWorkflowSchema'
|
|
|
|
interface NodeZIndexOptions {
|
|
/**
|
|
* Layout source for z-index mutations
|
|
* @default LayoutSource.Vue
|
|
*/
|
|
layoutSource?: LayoutSource
|
|
}
|
|
|
|
export function useNodeZIndex(options: NodeZIndexOptions = {}) {
|
|
const { layoutSource = LayoutSource.Vue } = options
|
|
const layoutMutations = useLayoutMutations()
|
|
|
|
/**
|
|
* Bring node to front (highest z-index)
|
|
* @param nodeId - The node to bring to front
|
|
* @param source - Optional source override
|
|
*/
|
|
function bringNodeToFront(nodeId: NodeId, source?: LayoutSource) {
|
|
layoutMutations.setSource(source ?? layoutSource)
|
|
layoutMutations.bringNodeToFront(nodeId)
|
|
}
|
|
|
|
return {
|
|
bringNodeToFront
|
|
}
|
|
}
|