Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svg viewbox match wrong #2245

Open
zfangqijun opened this issue Sep 29, 2023 · 0 comments
Open

svg viewbox match wrong #2245

zfangqijun opened this issue Sep 29, 2023 · 0 comments

Comments

@zfangqijun
Copy link

When importing svg, there is a valid viewbox and the viewbox attributes are not separated by spaces. (viewBox="-0.6,-0.39923,95.17898,99.84079")

Because the viewbox matches incorrectly, when editing the sprite, only the color is filled, but the sprite moves.

Expected Behavior

The sprite position should not change when first filling with color

Actual Behavior

When filling color for the first time, the sprite position changed

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://scratch.mit.edu/...'
  2. Upload Sprite
  3. Select an svg (there is a valid viewbox value, and the viewbox attributes are not separated by spaces)
  4. Click costumes to edit the sprite
  5. Use the fill tool to change the sprite color. When filling, you will find that the sprite of the stage moves (very slightly, you may not notice it, please try a few more times)
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
    width="95.17898" height="99.84079" viewBox="-0.6,-0.39923,95.17898,99.84079">
    <defs>
        <radialGradient cx="119" cy="181.33333" r="26.62928" gradientUnits="userSpaceOnUse"
            id="color-1">
            <stop offset="0" stop-color="#673ab7" />
            <stop offset="1" stop-color="#ff0000" />
        </radialGradient>
    </defs>
    <g transform="translate(-80.92102,-140.9)">
        <g data-paper-data="{&quot;isPaintingLayer&quot;:true}" fill-rule="evenodd"
            stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0"
            style="mix-blend-mode: normal">
            <g>
                <path
                    d="M112.7,211.1c0.8,0.4 2.5,1.3 0.1,4.7c-2.4,3.4 -9.3,4.1 -10.1,4.1c-3.1,0.1 -6.9,0.1 -11.1,-1.3c-12.2,-4 -12.3,-17.1 -8.4,-19.2c3.8,-2.1 5.5,6 11,10.9c2.4,2.2 5.3,3 7.7,3.5c3.4,0.6 9.9,-3.2 10.8,-2.7z"
                    fill="#ffab19" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                    stroke-linejoin="round" />
                <path
                    d="M87.9,203c1.6,2.7 4.7,6.5 4.7,6.5c0,0 -3.7,-0.9 -5.8,0.8c-1.7,1.3 -1.3,3.5 -1.1,4.2c-1.3,-1.3 -2.9,-3.1 -3.9,-6.6c-1,-3.5 0,-7.7 2,-8.3c2,-0.4 2.5,1.1 4.1,3.4z"
                    fill="#ffffff" stroke="none" stroke-width="1" stroke-linecap="butt"
                    stroke-linejoin="miter" />
            </g>
            <path
                d="M117.7,221.5c-1.8,1.2 -8,5.6 -15.9,8.1l-0.4,0.1c-0.4,0.1 -0.6,0.6 -0.4,1c1.7,2.4 4.8,7.2 -0.7,8.9c-5.3,1.7 -15.2,-12.4 -11,-16.1c1.9,-1.4 3.6,-0.7 4.5,-0.3c0.5,0.2 1,0.2 1.5,0.1c1.2,-0.4 3.4,-1.2 5.1,-2.1c4.3,-2.2 5.3,-3.1 7.3,-4.6c2,-1.5 6.6,-5.2 10.3,-2c3.2,2.7 1.4,5.7 -0.3,6.9z"
                fill="#ffab19" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                stroke-linejoin="round" />
            <path
                d="M133.6,200.7c0.5,0.4 6.6,7.6 8.6,5.8c2.4,-2.1 5.7,-6.2 9.3,-2.9c3.6,3.3 -3.2,8.9 -6.1,10.4c-6.9,3.1 -12.5,-2.8 -13.7,-4.4c-1.2,-1.6 -3.3,-4.3 -3.3,-6.9c0.1,-2.8 3.5,-3.5 5.2,-2z"
                fill="#ffab19" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                stroke-linejoin="round" />
            <g>
                <path
                    d="M133.7,224c2.1,1.9 6.7,5.8 6.7,5.8c0,0 14.3,-2.5 14.3,4.7c0,4.3 -7.2,5.3 -16.9,4.4c-0.6,-0.1 -1.2,-0.3 -1.7,-0.7c-2.2,-1.9 -8.5,-7.5 -12.5,-11.4c-5.9,-5.8 -10.8,-9.6 -10.8,-9.6c-8.5,-8.3 -1.6,-11.8 1.1,-16.6c2.5,-4.1 3.6,-3.3 9.6,-2.1c3.4,0.5 5.4,0.8 7.6,0.7c3.3,-0.1 2.7,4.7 1.8,7.2c0,0 -1.4,3.7 -2.7,5.6c-1.6,2.3 -2.8,3.8 -4,4.7z"
                    fill="#ffab19" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                    stroke-linejoin="round" />
                <path
                    d="M125.3,216.6c0,0 -1.5,-1.2 -3.1,-2.7c-2,-1.8 -4,-3.3 -2,-6.4c1.8,-2.4 3.5,-5.6 8,-2.7c4.3,2.7 2.4,5.2 2.4,5.2c-2.2,4.5 -5.3,6.6 -5.3,6.6z"
                    fill="#ffffff" stroke="none" stroke-width="1" stroke-linecap="butt"
                    stroke-linejoin="miter" />
            </g>
            <path
                d="M110.2,208.4c2.2,2.8 5.6,6.3 1.3,9.2c-5.9,3.3 -10.8,-6.7 -11.8,-10.2c-0.9,-3.1 1.7,-5.1 3.9,-6.8c4.3,-3.1 7.9,-5.9 11.9,-4.4c5,1.8 1.4,5.8 -1.1,7.6c-1.5,1.1 -3,2.3 -4.1,3c-0.3,0.5 -0.4,1.1 -0.1,1.6z"
                fill="#ffab19" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                stroke-linejoin="round" />
            <g>
                <path
                    d="M141.7,141c0.3,-0.2 0.8,-0.1 0.9,0.3l2.6,10.7c0,0 6.4,4.7 8.3,8c3.2,5.5 3.3,10 3.3,10c0,0 7.1,2.1 8.3,7.8c1.2,5.7 -3.2,16.5 -22,20.2c-18.8,3.7 -33.9,-1.4 -41,-12.8c-7.1,-11.4 4.1,-25 3.5,-24.2l-2.1,-17.9c-0.1,-0.4 0.4,-0.7 0.8,-0.5l12.1,7.9c0,0 4.5,-1.7 9.2,-1.9c2.8,-0.2 5.2,0 7.5,0.4z"
                    fill="#ffab19" stroke="#001026" stroke-width="1.2" stroke-linecap="butt"
                    stroke-linejoin="miter" />
                <path
                    d="M156.5,170.4c0,0 6.9,1.8 8.1,7.5c1.2,5.7 -3.6,16 -22.2,19.6c-24.2,5 -35.7,-9.4 -29,-20c6.7,-10.7 18.2,-1.6 26.6,-2.2c7.2,-0.5 8,-6.8 16.5,-4.9z"
                    fill="url(#color-1)" stroke="none" stroke-width="1" stroke-linecap="butt"
                    stroke-linejoin="miter" />
                <path
                    d="M125,181.1c0,-0.4 0.4,-0.7 0.8,-0.6c1.9,0.7 7.3,2.3 13.3,2.7c5.4,0.3 8.6,0 10.1,-0.3c0.5,-0.1 0.9,0.4 0.7,0.9c-0.9,2.7 -4.7,10.2 -15.2,9.6c-9.1,-1 -10,-7.4 -9.7,-12.3z"
                    fill="#ffffff" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                    stroke-linejoin="round" />
                <path d="M174.9,171.5c-4.7,3.8 -11.9,3.9 -11.9,3.9" fill="none" stroke="#001026"
                    stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" />
                <path d="M173.6,182.7c-6.3,0.5 -10.2,-1.4 -10.2,-1.4" fill="none" stroke="#001026"
                    stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" />
                <path
                    d="M139.6,172.7c2.1,0 4.3,0.2 4.4,0.9c0.1,1.4 -1.4,4.2 -3,4.3c-1.8,0.2 -6,-2.3 -6,-3.9c-0.1,-1.2 2.6,-1.3 4.6,-1.3z"
                    fill="#001026" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                    stroke-linejoin="round" />
                <path d="M94.6,171.2c0,0 8.6,2.8 12.1,5.9" fill="none" stroke="#001026"
                    stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" />
                <path d="M107,180.6c-4.3,1.7 -11.7,0.6 -11.7,0.6" fill="none" stroke="#001026"
                    stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" />
                <g>
                    <path
                        d="M151.4,161c2.9,4.5 3,9.6 0.2,11.4c-2.8,1.8 -7.4,-0.3 -10.4,-4.8c-2.9,-4.5 -3,-9.6 -0.2,-11.4c2.8,-1.9 7.5,0.3 10.4,4.8z"
                        fill="#ffffff" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                        stroke-linejoin="round" />
                    <path
                        d="M151,166.7c0,1.1 -0.8,2 -1.8,2c-1,0 -1.8,-0.9 -1.8,-2c0,-1.1 0.8,-2 1.8,-2c1,0 1.8,0.9 1.8,2"
                        fill="#001026" stroke="none" stroke-width="1" stroke-linecap="butt"
                        stroke-linejoin="miter" />
                </g>
                <g>
                    <path
                        d="M126.6,163.8c3,4.4 2.8,9.8 0.1,11.7c-3.3,1.9 -7.7,0.5 -10.7,-3.9c-3.1,-4.4 -3.3,-10.1 -0.2,-12.3c3.1,-2.3 7.8,0.1 10.8,4.5z"
                        fill="#ffffff" stroke="#001026" stroke-width="1.2" stroke-linecap="round"
                        stroke-linejoin="round" />
                    <path
                        d="M126,169.6c0,1.1 -0.8,2 -1.8,2c-1,0 -1.8,-0.9 -1.8,-2c0,-1.1 0.8,-2 1.8,-2c1,0.1 1.8,0.9 1.8,2"
                        fill="#001026" stroke="none" stroke-width="1" stroke-linecap="butt"
                        stroke-linejoin="miter" />
                </g>
            </g>
        </g>
    </g>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant