diff --git a/html/images/space.svg b/html/images/space.svg index aa7ba44..3369e27 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -625,18 +625,20 @@ const el = document.createElementNS(namespaceURIsvg, 'line'); el.setAttribute('x1', foot.x); el.setAttribute('y1', foot.y); - el.setAttribute('x2', xc); - el.setAttribute('y2', yc); - // the problem is that by this point the ship is already closer than - // its radius so the line is less than 5 units long + el.setAttribute('x2', s.position.x); + el.setAttribute('y2', s.position.y); + console.log("foot", foot, "line", el); const [posX, posY] = [5 * Math.sin(radAngle), 5 * Math.cos(radAngle)]; const collPt = el.getPointAtLength(5); // let l = drawLine(foot.x, foot.y, foot.x - posX, foot.y - posY); let l = drawLine(foot.x, foot.y, foot.x - posY, foot.y - posX); - console.log("line length", l.getTotalLength(), l); - s.position = { x: foot.x - posY, y: foot.y - posX }; - // s.position = { x: collPt.x, y: collPt.y }; + // s.position = { x: foot.x - posY, y: foot.y - posX }; + s.position = { x: collPt.x, y: collPt.y }; + console.log("line length", el.getTotalLength(), el, s.position); + console.log("line length", l.getTotalLength(), l, foot.x - posY, foot.y - posX); + + s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`; } else { console.log("c");