Agent skill
yfiles-nodestyle-interaction
Implements custom hit testing and edge cropping for node styles by overriding isHit and getOutline methods. Handles accurate click detection for custom shapes and proper edge connections. Use when implementing hit testing, custom click areas, edge cropping, or when user mentions "isHit", "hit testing", "getOutline", "edge cropping", or "edge connection points".
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/yfiles-nodestyle-interaction
SKILL.md
Node Style Interaction
Implement custom hit testing and edge cropping for accurate user interaction.
Quick Start
export class InteractiveNodeStyle extends NodeStyleBase {
protected isHit(
context: IInputModeContext,
location: Point,
node: INode
): boolean {
// Check if click is within node bounds
return node.layout.toRect().contains(location, context.hitTestRadius)
}
protected getOutline(node: INode): GeneralPath | null {
// Return path for edge cropping
const { x, y, width, height } = node.layout
const path = new GeneralPath()
path.appendRectangle(new Rect(x, y, width, height), false)
return path
}
}
Before Implementing
Always query yFiles MCP for current API:
yfiles:yfiles_get_symbol_details(name="NodeStyleBase")
yfiles:yfiles_list_members(name="NodeStyleBase")
yfiles:yfiles_search_by_description(query="hit testing")
yfiles:yfiles_get_symbol_details(name="GeneralPath")
Core Concepts
- isHit(): Determines if point hits the node
- getOutline(): Defines shape for edge cropping
- hitTestRadius: Tolerance area around edges
- GeneralPath: Defines arbitrary shapes
When to Implement
- isHit(): When node shape isn't rectangular
- getOutline(): When edges should crop at custom shape boundary
Note: When implementing yFiles interfaces, always use BaseClass() wrapper instead of TypeScript implements. The @yfiles/eslint-plugin rule @yfiles/fix-implements-using-baseclass enforces this pattern.
Code Examples
See examples.md for:
- Basic hit testing for custom shapes
- Hit testing with exclusion areas
- getOutline for edge cropping
- Complex shape outlines
- Circular and elliptical hit testing
Reference
See reference.md for:
- isHit() method signature and parameters
- getOutline() implementation patterns
- GeneralPath API
- Geometric utilities
Related Skills
/yfiles-nodestyle-basic- Basic rendering/yfiles-nodestyle-configure- Configuration/yfiles-nodestyle-advanced- Performance and group nodes
MCP Tools
yfiles:yfiles_get_symbol_details(name="GeneralPath")- Path construction APIyfiles:yfiles_get_symbol_details(name="GeometryUtilities")- Geometry helpersyfiles:yfiles_search_by_description(query="hit testing")- Documentation
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?