Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions models/Star/Star.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const uuid = require('uuid-v4');
const Layer = require('../Layer');
const Rect = require('../Rect');
const Style = require('../Style');

class Star extends Layer {
static get Model() {
return {
...super.Model,
_class: 'star',
numberOfPoints: 5,
radius: 0,
};
}

constructor(args, json) {
super(args, json);
if (!json) {
const id = args.id || uuid().toUpperCase();
Object.assign(this, Star.Model, {
do_objectID: id,
name: args.name || id,
style: args.style ? Style.LayerStyle(args.style) : null,
frame: new Rect(args.frame),
});
if (args.numberOfPoints) this.numberOfPoints = args.numberOfPoints;
if (args.radius) this.radius = args.radius;
}
}
}

module.exports = Star;
9 changes: 9 additions & 0 deletions models/Star/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Layer from '../Layer';

declare class Star extends Layer {
_class: 'star';
numberOfPoints: number;
radius: number;
}

export = Star;
1 change: 1 addition & 0 deletions models/Star/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./Star');
2 changes: 2 additions & 0 deletions models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import ShapePath from './ShapePath';
import SharedStyle from './SharedStyle';
import Sketch from './Sketch';
import Slice from './Slice';
import Star from './Star';
import StringAttribute from './StringAttribute';
import Style from './Style';
import SymbolInstance from './SymbolInstance';
Expand Down Expand Up @@ -66,6 +67,7 @@ export {
SharedStyle,
Sketch,
Slice,
Star,
StringAttribute,
Style,
SymbolInstance,
Expand Down
1 change: 1 addition & 0 deletions models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = {
SharedStyle: require('./SharedStyle'),
Sketch: require('./Sketch'),
Slice: require('./Slice'),
Star: require('./Star'),
StringAttribute: require('./StringAttribute'),
Style: require('./Style'),
SymbolInstance: require('./SymbolInstance'),
Expand Down