GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Duplicated SVG linearGradient definition for cells using the exact same gradient style in the Stencils story · Issue #676 · maxGraph/maxGraph

Duplicated SVG linearGradient definition for cells using the exact same gradient style in the Stencils story #676

New issue
Copy link
New issue
Copy link
Open
Bug
Open
Duplicated SVG linearGradient definition for cells using the exact same gradient style in the Stencils story#676
Bug
Copy link

Description

@tbouffard
tbouffard
opened on Feb 14, 2025
Issue body actions

Describe the bug

When several cells use the same configuration to create a color gradient (gradientColor, gradientDirection and fillColor), the SVG is supposed to include a single SVG linearGradient which is reused for all rendered Cell.
This was the behavior in mxGraph 4.2.2.

When the Graph is rendered for the first time, the linearGradient is duplicated in the SVG (including the usage of the same id).

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://maxgraph.github.io/maxGraph/demo/?path=/story/shapes-stencils--default
  2. Inspect the DOM to see that the linear gradient definition is duplicated

Expected behavior

A single SVG linearGradient definition for all cells sharing the exact same gradient style

Ideally, the linearGradient definition should be stored in a defs element and not directly in the svg element: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs

Screenshots

maxGraph 0.15.1

Image

mxGraph 4.2.2

Image

Environment

  • maxGraph version or commit: 0.15.1
  • Desktop or mobile: Desktop (no test on mobile)
  • OS and version: [e.g. iOS 14.1] Ubuntu 22.04
  • Browser and version: [e.g. chrome 118, safari 15] Chrome, Firefox

Additional context

Additional tests should be done to verify if this behavior occurs outside Storybook. We already saw specific rendering issues due to Storybook like in #545.

In addition, when redrawing a Cell or the whole Graph, the duplicated linearGradient are removed. See videos below 👇🏿

Redrawing individual cells

issue_676_duplicated_linearGradient_removed_after_redraw_individual_cell.webm

Full Graph redraw by zooming

issue_676_duplicated_linearGradient_removed_after_zoom.webm

Activity

  1. tbouffard
    added
    bugSomething isn't working
    on Feb 14, 2025
  2. tbouffard
    changed the title [-][BUG] Duplicated SVG linearGradient definition for cells using the exact same gradient style[/-] [+][BUG] Duplicated SVG linearGradient definition for cells using the exact same gradient style in the Stencils story[/+] on Feb 14, 2025
  3. tbouffard
    added a parent issue on Feb 14, 2025
    • Ensure that the stories work as the mxGraph examples #505
  4. tbouffard
    changed the title [-][BUG] Duplicated SVG linearGradient definition for cells using the exact same gradient style in the Stencils story[/-] [+]Duplicated SVG linearGradient definition for cells using the exact same gradient style in the Stencils story[/+] on Feb 14, 2025
  5. tbouffard
    removed
    bugSomething isn't working
    on May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.