Skip to content

Commit

Permalink
Update shape creation in export function
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchuan committed Dec 16, 2023
1 parent 909cc43 commit 7b0cf9b
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/exports/generator/shape.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
import parse_shape_commands from '../../parser/parse-shape-commands.js';
import { shapes, create_shape_points } from '../../generator/shapes.js';
import { create_shape } from '../../generator/shapes.js';

export default function shape(type = '', ...args) {
type = String(type).trim();
let points = [];
if (type.length) {
if (typeof shapes[type] === 'function') {
points = shapes[type](args);
} else {
let commands = type;
let rest = args.join(',');
if (rest.length) {
commands = type + ',' + rest;
}
let config = parse_shape_commands(commands);
points = create_shape_points(config, {min: 3, max: 3600});
}
}
export default function shape(...args) {
let commands = args.join(',');
let { points } = create_shape(commands, 3, 3600);
return `polygon(${points.join(',')})`;
}

0 comments on commit 7b0cf9b

Please sign in to comment.