You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Path.Rectangle.extend doesn't work and I'm not sure how to make Base.extend work in this scenario. I've messed with Rectangle.extend and it's promising but doesn't cut it.
The es6 equivalent of what I'm wanting to accomplish would look something like
class RedSquare extends Path.Rectangle {
constructor(obj) { // obj is the json object with initial settings eg {size:50}
obj.fillColor = 'red';
super(obj);
}
}
new RedSquare({ size:50 });
The text was updated successfully, but these errors were encountered:
Path.Rectangle and co aren't real constructors / sub-classes, they actually return plain Path items. This was probably a bit of a poor design decision, which we went for to reflect how things were done in Scriptographer... These constructors are there as a way to create path items with pre-populated / constructed segments arrays. They are actually factories internally, but you use them with new in front (but you don't have to with these, since they have an explicit return statement...)
As for sub-classing Paper.js classes, that's something that we don't officially support. It is possible, and people are doing it, but we're not supporting it.
Path.Rectangle.extend
doesn't work and I'm not sure how to makeBase.extend
work in this scenario. I've messed withRectangle.extend
and it's promising but doesn't cut it.The es6 equivalent of what I'm wanting to accomplish would look something like
The text was updated successfully, but these errors were encountered: