chore: Changes required for ES6 version of bezier-js
This commit is contained in:
parent
5c014d8143
commit
12692e1a64
4 changed files with 27 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
import Attributes from './attributes'
|
||||
import Point from './point'
|
||||
import Bezier from 'bezier-js'
|
||||
import { Bezier } from 'bezier-js'
|
||||
import {
|
||||
linesIntersect,
|
||||
lineIntersectsCurve,
|
||||
|
|
3
packages/core/src/round.js
Normal file
3
packages/core/src/round.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default function round(value) {
|
||||
return Math.round(value * 1e2) / 1e2
|
||||
}
|
21
packages/core/src/splitcurve.js
Normal file
21
packages/core/src/splitcurve.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import Path from './path'
|
||||
|
||||
/** Splits a curve on a point */
|
||||
export default function splitCurve(start, cp1, cp2, end, split) {
|
||||
let [c1, c2] = new Path().move(start).curve(cp1, cp2, end).split(split)
|
||||
|
||||
return [
|
||||
{
|
||||
start: c1.ops[0].to,
|
||||
cp1: c1.ops[1].cp1,
|
||||
cp2: c1.ops[1].cp2,
|
||||
end: c1.ops[1].to
|
||||
},
|
||||
{
|
||||
start: c2.ops[0].to,
|
||||
cp1: c2.ops[1].cp1,
|
||||
cp2: c2.ops[1].cp2,
|
||||
end: c2.ops[1].to
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import Path from './path'
|
||||
import Point from './point'
|
||||
import Bezier from 'bezier-js'
|
||||
import { Bezier } from 'bezier-js'
|
||||
|
||||
export function capitalize(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||
|
@ -349,4 +349,4 @@ export function rad2deg(radians) {
|
|||
}
|
||||
|
||||
// Export bezier-js so plugins can use it
|
||||
export { default as Bezier } from 'bezier-js'
|
||||
export { Bezier }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue