SVG-Edit / svgedit

Powerful SVG-Editor for your browser
MIT License
6.72k stars 1.57k forks source link

Layer panel does not work as expected for layer created for orphan elements #997

Closed VenissaCarolQuadros closed 1 month ago

VenissaCarolQuadros commented 1 month ago

PLEASE NOTE: We are trying to make this project live again. While you can file an issue, we will do our best but you should not expect any action, even if we label the issue. However, we are welcoming new contributors

Describe the bug When a new file is imported, if elements are not part of a layer they are automatically assigned to a layer. However, the 'eye' icon in the layer panel is not visible indicating that the layer is invisible but it is not. Also, toggling this does not modify the visibility.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://svgedit.netlify.app/editor/index.html
  2. Import the following SVG file :
    <svg width="254.00000000000003" height="105.83333" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" version="1.1" xml:space="preserve">
    <rect fill="#FF0000" height="11" id="svg_1" stroke="#000000" stroke-width="5" width="37" x="108.5" y="63.82"/>
    </svg>
  3. Try toggling visibility in the LayerPanel

Expected behavior Completely functional LayerPanel for new layer created for orphan elements

SVG-Edit environment (IMPORTANT)

Desktop :

Screenshots image image

Potential resolution I believe the issue is caused by 'name' not being defined. This results in it not being added to layer_map. Initializing name as 'getNewLayerName(layernames)' should resolve this.

Please let me know if I've been amiss in tracing the root cause.

jfhenon commented 1 month ago

you are right. fixing this.