mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-11-05 14:13:23 +01:00
move function
This commit is contained in:
parent
0acda53661
commit
2f1c6da5e1
@ -9,6 +9,12 @@ import { SHAPE_CACHE_LIMIT } from '../constants/general.js';
|
||||
import { createText } from '../utils/textUtils.js';
|
||||
import { segmentBezierPath } from '../utils/curveUtils.js';
|
||||
|
||||
const setDirection = (clockwise) => (path) => {
|
||||
return (THREE.ShapeUtils.isClockWise(path) === clockwise) ? path : path.reverse();
|
||||
};
|
||||
const setDirectionClockWise = setDirection(true);
|
||||
const setDirectionCounterClockWise = setDirection(false);
|
||||
|
||||
const HEART_BEZIER_PATH = [
|
||||
new Vector(0.0, -0.5),
|
||||
new Vector(0.1, -1.1),
|
||||
@ -203,11 +209,6 @@ function shapeToPointsRaw(shapeData) {
|
||||
|
||||
// make sure all shapes are clockwise and all holes are counter-clockwise
|
||||
if (shapeData.fill) {
|
||||
const setDirection = (clockwise) => (path) => {
|
||||
return (THREE.ShapeUtils.isClockWise(path) === clockwise) ? path : path.reverse();
|
||||
};
|
||||
const setDirectionClockWise = setDirection(true);
|
||||
const setDirectionCounterClockWise = setDirection(false);
|
||||
for (const shape of shapes) {
|
||||
shape.points = setDirectionClockWise(shape.points);
|
||||
shape.holes = shape.holes.map(setDirectionCounterClockWise);
|
||||
|
Loading…
Reference in New Issue
Block a user