Skip to content

viewbox minx/miny is other than 0 (not supported) #60

Open
@StanKocken

Description

I have this issue with: viewbox minx/miny is other than 0 (not supported).
I understand the issue, the fix I'm doing on my side is to play with translateX, translateY. Can this be integrate into the tool?

Imagine I have a SVG:

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="10 -10 30 30" enable-background="new 10 -10 30 30" xml:space="preserve">
<g>
     <rect width="26" height="26" x="12" y="-8" fill="#FF0000" />
</g>
</svg>

The convert will produce:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="30dp"
    android:height="30dp"
    android:viewportWidth="30"
    android:viewportHeight="30">
    <path
        android:fillColor="#FF0000"
        android:pathData="M 12 -8 H 38 V 18 H 12 V -8 Z" />
</vector>

Why not wrap it with a group translate:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="30dp"
    android:height="30dp"
    android:viewportWidth="30"
    android:viewportHeight="30">
    <group
        android:translateX="-10"
        android:translateY="10">
        <path
            android:fillColor="#FF0000"
            android:pathData="M 12 -8 H 38 V 18 H 12 V -8 Z" />
    </group>
</vector>

Thanks

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions