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 Path Still Gets Butchered Sometimes in Symbol Mark #3377

Closed
Raventara opened this issue Jan 3, 2022 · 9 comments
Closed

SVG Path Still Gets Butchered Sometimes in Symbol Mark #3377

Raventara opened this issue Jan 3, 2022 · 9 comments
Labels
bug For bugs or other software errors

Comments

@Raventara
Copy link

Many shapes will still be butchered when rendered from shape path data:

{
      "type": "symbol",
      "encode": {
        "enter": {
          "fill": {"value": "#939597"},
          "stroke": {"value": "#652c90"},
          "x": {"value": 100},
          "y": {"value": 100},
          "size": {"value": 1000},
          "shape": {"value": "M 3.242042,0 C 3.1779507,0 3.12361,0.032655 3.0849523,0.07131046 c -0.00151,0.001325 -0.00235,0.0026006 -0.00362,0.0041339 l -0.120401,0.14830508 c -0.00305,0.002291 -0.00495,0.005466 -0.00775,0.008268 -0.00941,0.009408 -0.016882,0.020601 -0.022737,0.0325548 -0.00151,0.002537 -0.00286,0.005466 -0.00413,0.008268 -1.895e-4,7.5718e-4 -0.00173,0.001348 -0.00207,0.002067 v 0.003617 c -0.00509,0.0150109 -0.00775,0.0312555 -0.00775,0.0470236 V 3.1252583 c 0,0.034081 0.01201,0.068862 0.036688,0.09353 0.024671,0.024671 0.05945,0.036688 0.09353,0.036689 h 1.8230674 c 0.034081,0 0.068861,-0.012028 0.09353,-0.036689 C 4.9879778,3.1941198 5,3.1593386 5,3.1252583 V 0.32554775 c 0,-0.0307752 -0.010644,-0.0613549 -0.030488,-0.0852625 -5.677e-4,-0.001325 -0.00136,-0.002866 -0.00207,-0.004134 -7.572e-4,-7.5716e-4 -0.00136,-0.001348 -0.00207,-0.002067 -0.0017,-0.002802 -0.00391,-0.005731 -0.0062,-0.008268 L 4.8310252,0.07131046 c -1.894e-4,-5.6788e-4 -0.00173,5.6787e-4 -0.00207,0 -1.892e-4,-1.8929e-4 1.894e-4,-0.0017262 0,-0.002067 C 4.7938565,0.02397229 4.7399036,0 4.6801363,0 Z m 0,0.1302191 h 1.4380943 c 0.017301,0 0.04321,0.0150666 0.047024,0.020153 7.569e-4,7.5718e-4 0.00136,0.001348 0.00207,0.002067 l 0.034622,0.0428896 H 3.1505786 l 0.026354,-0.0325548 h 0.00207 C 3.2039214,0.13784972 3.2158462,0.1302191 3.242042,0.1302191 Z M 3.0467134,0.32554775 H 4.8697808 V 3.1252583 H 3.0467134 Z M 1.4122571,0.48057046 0.20359652,0.93478707 C 0.0878002,0.99532231 0.08474576,1.1618526 0.08474576,1.298057 c 0,0.045401 0.0054717,0.090429 0.01395205,0.1328028 C 0.00267314,1.4974486 0,1.652094 0,1.7822447 c 0,0.1059367 0.02261215,0.2024867 0.08474576,0.2630219 -0.01412127,0.051455 -0.0056842,0.1150088 -0.0056842,0.190678 0,0.1362042 0.03378277,0.2604363 0.14675486,0.302811 L 1.011265,2.8870399 2.4007854,2.2695328 2.2540305,2.2121744 V 1.8788755 l 0.1467549,-0.06666 -0.2263332,-0.09043 V 1.4308598 L 2.4064695,1.3280281 2.259198,1.2706697 V 0.94098798 l 0.1472715,-0.0666598 z m 1.9600041,0.10541548 c -0.034081,0 -0.068862,0.0120107 -0.09353,0.0366887 -0.024671,0.0246706 -0.036689,0.0594501 -0.036689,0.0935304 V 1.0417528 c 0,0.02238 0.00534,0.045018 0.016019,0.065109 -0.010676,0.020093 -0.016019,0.04273 -0.016019,0.06511 v 0.3255477 c 0,0.034081 0.012028,0.068859 0.036689,0.09353 0.024669,0.024669 0.05945,0.036689 0.09353,0.036689 H 4.544233 c 0.034079,0 0.06886,-0.012011 0.09353,-0.036689 0.024671,-0.024671 0.036689,-0.059452 0.036689,-0.09353 V 1.1719719 c 0,-0.02238 -0.00586,-0.045016 -0.016536,-0.06511 0.010677,-0.020091 0.016536,-0.042729 0.016536,-0.065109 V 0.71620501 c 0,-0.0340822 -0.012009,-0.0688598 -0.036689,-0.0935304 -0.024671,-0.0246687 -0.059452,-0.0366887 -0.09353,-0.0366887 z m 0,0.13021907 H 4.544233 V 1.0417528 H 3.3722612 Z M 2.1491318,0.98904502 V 1.2494832 L 1.0226333,1.7517569 0.23718478,1.4189747 V 1.1466515 L 1.0226333,1.4763331 Z M 3.3722612,1.1719719 H 4.544233 V 1.4975196 H 3.3722612 Z M 2.0674865,1.4794336 v 0.2573377 h -0.0031 L 0.93788754,2.2359446 0.15243902,1.9031624 V 1.6308391 l 0.80766842,0.345184 z M 2.1465481,1.9155642 2.1434476,2.190988 1.0169491,2.6901612 0.2289169,2.357379 V 2.1212277 L 0.93220337,2.429723 Z m 1.8116991,0.1679413 c -0.071721,0 -0.1302192,0.058498 -0.1302192,0.1302191 0,0.071721 0.058498,0.1302191 0.1302192,0.1302191 0.071721,0 0.130219,-0.058498 0.130219,-0.1302191 0,-0.071721 -0.058498,-0.1302191 -0.130219,-0.1302191 z m 0,0.4557668 c -0.071721,0 -0.1302192,0.058496 -0.1302192,0.1302192 0,0.071719 0.058498,0.130219 0.1302192,0.130219 0.071721,0 0.130219,-0.0585 0.130219,-0.130219 0,-0.071723 -0.058498,-0.1302192 -0.130219,-0.1302192 z"}
        }
      }
    }

Which should look like:
image

Results in:
image

From either older kibana V6x rendering or the Vega Editor on V5.21.0

@Raventara Raventara added the bug For bugs or other software errors label Jan 3, 2022
@Raventara
Copy link
Author

#2803

@p-himik
Copy link

p-himik commented Feb 17, 2022

Just discovered this as well. :(

A simple path M1 0A1 1 0 00-1 0 1 1 0 001 0M0-1 1 0M-1 0 0 1:
image

gets mangled into M11.180339887498949,0C11.180339887498949,6.174731217790598,6.174731217790599,11.180339887498949,6.845983728302534e-16,11.180339887498949M0,-11.180339887498949L11.180339887498949,0M-11.180339887498949,0L0,11.180339887498949:
image

@p-himik
Copy link

p-himik commented Feb 17, 2022

Given that it's not the first occurrence, maybe having a "do not touch my SVG paths" mode in Vega (of course, for SVG backend only) would be not so bad of a solution.

@p-himik
Copy link

p-himik commented Feb 17, 2022

The reason at least for my change seems to be that, while M1 0A1 1 0 00-1 0 1 1 0 001 0 is a perfectly valid SVG (at lest, works in all browsers and editors that I've tried), the SVG parser cannot handle 00-1 and 001 parts.

The standard is terse but unambiguous here:

Superfluous white space and separators (such as commas) may be eliminated

00 above are flags, so separating them from each other and from the next number is indeed superfluous.

@p-himik
Copy link

p-himik commented Feb 17, 2022

Another example: M.5-.8.5.8 gets parsed as M 0.5 -0.8. The implicit line part gets chopped of.

@jheer
Copy link
Member

jheer commented Mar 9, 2022

Fixed in 5.22.0. The primary issue was that with a closing z or Z the current x, y position was not being reverted back to the starting point of the shape.

@jheer jheer closed this as completed Mar 9, 2022
@jheer
Copy link
Member

jheer commented Mar 9, 2022

Also, please note that any path parsing problems (which is not the primary issue the OP shared) should be opened as a separate issue. Thanks!

@p-himik
Copy link

p-himik commented Mar 9, 2022

@jheer So... should I just create an issue with basically a copy-paste of my messages? Or have the underlying issues been fixed as well?

@jheer
Copy link
Member

jheer commented Mar 9, 2022

Sure, if you can collect your path parsing problem examples then copy/paste to a new bug report, that would be very helpful. Otherwise I will get to it, but I may be slower... Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For bugs or other software errors
Projects
None yet
Development

No branches or pull requests

3 participants