jacopocolo / p5-sketchplugin

A plugin for using p5.js code inside Sketch
http://www.jacopocolo.com/p5sketchplugin/
GNU Lesser General Public License v2.1
220 stars 12 forks source link

Add name argument to shape functions #27

Open paulvollmer opened 6 years ago

paulvollmer commented 6 years ago

Context:

at the moment the shape fuctions like rect set the shape name to a hard coded name. if a user want to set a name for a shape it is not possible at the moment

Solution:

add an optional argument name to all shape functions to support custom names. then we can change the following lines of the shapes to:

shape.setName(name ? name : 'Rectangle');

Next steps:

jacopocolo commented 6 years ago

Hi! Could you give me an example of a use case? Do you often end up with too many shapes and you need a way to distinguish them?

It was a very intentional decision not to allow this to maintain as much consistently as possible with p5.js. Of course, it could be an optional argument of each function but I still want to hear how this feature would be useful.

Thanks!

paulvollmer commented 6 years ago

if you do some dataviz with the plugin it is good to know which shape is which data item. if you can give the shape a name it's easier to select from the layer panel. i can understand your decision to implement only the processing shape arguments for the functions.