Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$bridge.on('pointerleave', (e) => {
if (!map.drawing) return;
let out = svgPointerPosn(e, $svg);
if (Point.distance(enter || out, out) < 40) {
crossed = false;
} else {
$bridge.addClass('green');
totalCrossed += 1;
if (totalCrossed === $bridges.length) {
$solveds[i].enter();
$skip.exit('pop');
$section.score('bridge-' + i);
success = true;
}
}
});
function expandSegment($geopad, [e1, e2], line) {
let swap = Point.distance(e1.val, line.p1) > Point.distance(e2.val, line.p1);
$geopad.animatePoint(swap ? e2.name : e1.name, line.p1);
$geopad.animatePoint(swap ? e1.name : e2.name, line.p2);
}
function round(a: Point, b: Point) {
return Math.round(Point.distance(a, b) / 25) / 2;
}
function round(a, b) { return Math.round(Point.distance(a, b) / 25) / 2; }
$step.model.set('roundD', round);
reset() {
this.clearTail();
const q1 = this.model[this.points[0]];
const q2 = this.model[this.points[1]];
this.lengths = [Point.distance(this.center, q1), Point.distance(q1, q2)];
this.state = [PI2 - q1.angle(this.center), PI2 - q2.angle(q1), 0, 0];
}
}
function expandSegment($geopad: Geopad, [e1, e2]: GeoPoint[], line: Line) {
let swap = Point.distance(e1.val!, line.p1) > Point.distance(e2.val!, line.p1);
$geopad.animatePoint(swap ? e2.name : e1.name, line.p1);
$geopad.animatePoint(swap ? e1.name : e2.name, line.p2);
}
function redraw() {
if (points.length < 2) return $path.points = [];
let matrix = repeat2D(0, points.length, points.length);
for (let i = 0; i < points.length; ++i) {
for (let j = 0; j < i; ++j) {
matrix[i][j] = matrix[j][i] = Point.distance(points[i], points[j]);
}
}
const tsm = travellingSalesman(matrix);
$path.points = tsm.path!.map(i => points[i]);
}
$el.on('pointerup', (e: ScreenEvent) => {
if (!start) return;
const end = pointerPosition(e);
if (Point.distance(start, end) < 6) $el.trigger('tap', e);
start = undefined;
});
function round(a, b) { return Math.round(Point.distance(a, b) / 25) / 2; }
$step.model.set('roundD', round);