Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_positionMarker(path, location, end){
if (this.marker) {
let point = Snap.path.getPointAtLength(path, location);
let now = point;
if (end && end - location < 1) {
// Snap.svg at very end of path returns rotation as 90 degrees
while (point.alpha === 90) {
location -= 1;
point = Snap.path.getPointAtLength(path, location);
}
}
this.marker.transform('translate(' + now.x + ',' + now.y + ') rotate('+ (point.alpha - 90)+')');
}
}
function expectIntersection(a, b, point) {
var aPath = Snap.path.get[a.type](a);
var bPath = Snap.path.get[b.type](b);
expectPathIntersection(aPath, bPath, point);
}
function expectPathIntersection(aPath, bPath, point) {
var intersections = Snap.path.intersection(aPath, bPath);
forEach(intersections, function(i) {
paper.circle(i.x, i.y, 4);
});
expect(intersections.length).to.equal(1);
expect(Math.abs(intersections[0].x - point.x) < 0.5).to.equal(true);
expect(Math.abs(intersections[0].y - point.y) < 0.5).to.equal(true);
}
render() {
const { path, pointsById } = this.props
const d = pathCode(path, pointsById)
const { x, y, width, height } = Snap.path.getBBox(d)
return (