clientIO / joint

A proven SVG-based JavaScript diagramming library powering exceptional UIs
https://jointjs.com
Mozilla Public License 2.0
4.48k stars 839 forks source link

[Bug]: Grid-layer display only one when two or more papers exist at the same time #2648

Closed tkaabbc closed 3 weeks ago

tkaabbc commented 3 weeks ago

Current versus expected behaviour

Hi team

When I create multiple papers at the same time, I found only one grid-layer of paper can be displayed.

After all my troubleshooting, I found that the problem was caused by each grid-layers of paper having the same id pattern_0.

...
<pattern id="pattern_0"
...
<g class="joint-grid-layer" style="pointer-events: none;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="v-5" width="0" height="0" x="0" y="0"><defs id="v-4"><pattern id="pattern_0" patternUnits="userSpaceOnUse" width="20" height="20" x="0" y="0"><path id="v-6" d="M 20 0 H0 M0 0 V0 20" stroke="#AAAAAA" stroke-width="1"></path></pattern></defs><rect id="v-8" width="100%" height="100%" fill="url(#pattern_0)"></rect></svg></g>
image

I created a demo: https://codepen.io/Tingkeng-Wang/pen/VwOZYWy

(And thank you for such a great lib!)

Steps to reproduce

  1. New multiple paper instances at the same time.
  2. You will find only one paper display grid layer as expected.

Version

4.0.1

What browsers are you seeing the problem on?

No response

What operating system are you seeing the problem on?

No response