canvg icon indicating copy to clipboard operation
canvg copied to clipboard

Cater transform on clipPath element

Open takerusilt opened this issue 3 years ago • 6 comments

transform attribute is allowed on <clipPath> element and should be honored.

<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <style>
      .circle{clip-path: url(#clip-path);}
    </style>
    <clipPath id="clip-path" transform="translate(50)">
      <circle cx="50" cy="50" r="50" />
    </clipPath>
  </defs>
  <rect width="100" height="100" fill="red" class="circle" />
</svg>

Incorrect result before fix: incorrect Correct result after fix: correct

takerusilt avatar Apr 22 '21 10:04 takerusilt

this looks fine just needs a test! the best way to do that:

  1. add your svg example to test/svgs/issueXXXX.svg
  2. add to bottom of test/svgs.json giving it a name
  3. add as option to test/browser/index.html, giving it the same name
  4. make commit with [ci update snapshots] in message
  5. wait when new snapshots will generated
  6. download new snapshots from artifacts https://github.com/canvg/canvg/actions/runs/XXXX
  7. make commit with new snapshots placing them in test/__image_snapshots__/ (there should be 3: browser/node/offscreen)

gabelerner avatar Apr 22 '21 16:04 gabelerner

@dangreen what's the correct way to trigger snapshots these days?

gabelerner avatar Apr 24 '21 01:04 gabelerner

@gabelerner commit message should contain [ci update snapshots]

dangreen avatar Apr 25 '21 10:04 dangreen

@gabelerner commit message should contain [ci update snapshots]

@dangreen Had already [ci update snapshots] in the message, but once added a new entry in test/svgs.json, it had the following error:

New snapshot was not written. The update flag must be explicitly passed to write a new snapshot.

Otherwise snapshots are created and can be download through artifects.

takerusilt avatar Apr 26 '21 05:04 takerusilt

@takerusilt

You can read about screenshots updating here and here

dangreen avatar Apr 26 '21 05:04 dangreen

i think this should pass @takerusilt , can you push up an empty commit to retrigger the builds?

git commit --allow-empty -m "trigger GitHub actions"
git push

gabelerner avatar Jul 12 '21 02:07 gabelerner