Skip to content

motion: fix multiple closed subpaths; respect transform for motion vector

This merge request improves the Motion extension (that should probably be renamed because the name ist really incomprehensible, maybe something like "Extrude at angle"? idk) on several fields.

  • Fix #266 (closed). The improvements made by @sizmailov are great, but the handling of multiple closed subpaths was suboptimal - it always extruded a line from the end point of the command before Z to the first node of the path in total. Note that Inkscape 0.92.4 didn't draw an extruded shape for a "Z" command at all (see e.g. the stem of the "P" in the image below.
  • Handle shape transforms during the computation of the vertical and horizontal offset. The "extruded" border has the same transform applied as the original path (so the node coordinates are correct). If the user requests an angle of 45° and a length of 2mm, that should happen and not "well, the shape is transformed, deal withit yourself". Admittedly, transformed paths are not that common since Inkscape applies transforms on paths - unless that path is a star.
  • Clarify the user interface. I believe that any action by a user should prompt a response, so if the selection doesn't contain paths, an error message is displayed (this adresses #116, although it arguably doesn't fix it, so not auto-closing it). Also "Magnitude" may be mathematically correct for a vector, but "Length" should be clearer.
  • At the moment, the extension doesn't have a concept of "above" and "below" and adds the extruded shapes sequentially as it traverses the path. That leads to ugly border lines, and most users probably don't want a different border color on the extrusion (e.g. when using it as a drop shadow as in #266 (closed)). Therefore I added an option to pick the extrusions's fill color from the path border (including the fill-opacity attribute). This change depends on !294 (merged) and would have to be reversed when backporting.

The file below has been added as a unit test. All paths shown have been extruded with the same settings for angle and magnitude. The "This MR" section uses the new option to pick the stroke color as fill.

motion-fix-demo.svg

Merge request reports