aktos-io / aecad

Open Source Circuit Board Design Software that runs on the browser and desktop
https://aktos.io/aecad
54 stars 10 forks source link

SVG export contains lots of empty <g> attributes #96

Open ceremcem opened 2 years ago

ceremcem commented 2 years ago

This code is removed from source:

        # Cleanup empty layers (layers that we never created)
        cleanup-limit = 10
        for i in reverse [til svg.children.length]
            child = svg.children[i]
            # first level is treated as "Layers"
            if empty (child?.children or [])
                console.warn "Deleting Layer?: ", child
                svg.children.splice i, 1
                cleanup-limit --

            if cleanup-limit is 0
                PNotify.notice text: """
                    We still need to remove empty layers from SVG (there were #{svg.children.length} layers). 
                    Fix this."""
                break

Fix the svg object so that it shouldn't contain those empty <g> nodes: https://github.com/aktos-io/aecad/blob/235e6b96b1932d9da4c533f121dd9c0801591612/webapps/main/pcb/kernel/import-export.ls#L80-L86