Skip to content

Add "svg" type for [draw svg] containers

Jonathan Wilkes requested to merge drawsvg into master

This makes it possible to define an editable viewport outside of which the contents are clipped.

One big benefit is that the getrect routine doesn't need to fetch the bboxes of the shapes inside the viewport. It just needs the svg width, height, x, y, and parent transform. It's also possible to add an optimized branch if there is no parent transform specified.

One drawback is that the HTML5 method getBBox() includes the clipped content in its calculation. That means the user will get scrollbars even though the [draw svg] is clipping the contents which cause the scrollbars. Hopefully we can just work around this by adding a "scrollbars" method for canvases to just turn them off altogether.

Code for an experimental [draw array] is also added here. Combining it with the viewport of [draw svg] will make it possible to interact with arrays of widgets without the performance penalty normally associated with mouse motion on Pd canvases.

Also:

  • fixes some display bugs in certain cases for [draw image] and [draw sprite]
  • adds a default png for both [draw image] and [draw sprite] if none are given

Merge request reports