scratchfoundation / scratch-paint

Paint editor for Scratch 3.0
https://llk.github.io/scratch-paint/
BSD 3-Clause "New" or "Revised" License
174 stars 221 forks source link

Some radial gradients are misrecognized as vertical gradients #1012

Open adroitwhiz opened 4 years ago

adroitwhiz commented 4 years ago

Expected Behavior

All radial gradients should be properly recognized as radial when selected

Actual Behavior

If a radial gradient's destination point lies directly above or beneath its origin point, the gradient will be treated as a vertical gradient: image

The culprit appears to be this code, which sets the selected item's gradient type to vertical if the gradient's destination point is directly above or beneath its origin point, without ensuring the gradient is linear.

Steps to Reproduce

  1. Import this SVG into the paint editor
  2. Select the circle
  3. Observe the fill color indicator

Operating System and Browser

All

BryceLTaylor commented 4 years ago

@adroitwhiz Can you provide reproduction steps for how to produce an svg that has these properties in Scratch?

adroitwhiz commented 4 years ago

@BryceLTaylor

  1. Create a shape
  2. Fill the shape with a radial gradient
  3. Rotate the shape precisely 90 degrees clockwise or counterclockwise by holding the shift key when dragging the rotation handle
  4. Copy and paste the shape (not sure why this is necessary but it is)
  5. Observe that the shape's gradient is now reported as vertical Peek 2020-04-27 22-20

This isn't how I obtained the SVG I uploaded above-- I used an external editor (Inkscape) to create that.

BryceLTaylor commented 4 years ago

Thanks!