rmp icon indicating copy to clipboard operation
rmp copied to clipboard

#497 Add dynamic glow effect for selected

Open Copilot opened this issue 5 months ago • 1 comments

Implements a dynamic fluorescent yellow glow effect for all selected elements (stations, misc nodes, and line styles) using SVG filter animations, addressing the user request for visual feedback without modifying individual element components.

Problem

Users needed a visual indicator to clearly identify selected elements on the canvas. The requirement was to implement a dynamic glow effect (外发光效果) using SVG animation functionality while avoiding modifications to each individual element implementation.

Solution

Added an animated SVG filter that applies a fluorescent yellow pulsating glow effect to selected elements:

Technical Implementation

  • SVG Filter Definition: Created #selected-glow filter with animated Gaussian blur
  • Dynamic Application: Filter is conditionally applied to all components (pre, main, post) of selected elements based on Redux state
  • Universal Compatibility: Works automatically for all element types without individual modifications

Key Changes

  1. SVG Filter (svg-wrapper.tsx): Added animated fluorescent yellow glow filter with fast 0.5-second pulsating cycle
  2. Conditional Rendering (svg-layer.tsx): Wrap all selected element components (pre, main, post) with glow filter group
  3. State Integration (svg-canvas-graph.tsx): Pass selection state to SVG layer

The filter uses feColorMatrix to create fluorescent yellow color and feGaussianBlur with <animate> to create a smooth fast pulsating effect from 1px to 3px blur radius, providing clear visual feedback with crisp edges for element selection.

Visual Result

Fluorescent Yellow Glow Effect

The screenshot shows a station with the bright fluorescent yellow animated glow effect applied, demonstrating the smooth visual feedback for selected elements.

Benefits

  • Zero breaking changes: Preserves all existing functionality
  • Performance optimized: Filter only applies to selected elements
  • Maintainable: Centralized effect definition
  • Universal: Works for stations, misc nodes, and line segments automatically (including pre and post components)
  • Professional appearance: Smooth animated fluorescent yellow glow with proper layering and clear edges
  • Fast feedback: Quick 0.5s animation cycle for responsive visual indication

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Sep 13 '25 02:09 Copilot

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • railmapgen.org
    • Triggering command: node /home/REDACTED/work/rmp/rmp/node_modules/.bin/vite --host (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar Sep 13 '25 03:09 Copilot