Farben, aufräumen und Beispielkarte

This commit is contained in:
Adrian Heine 2020-09-18 10:45:35 +02:00
parent 8090edbd69
commit 03967a5789
3 changed files with 261 additions and 18 deletions

View file

@ -72,12 +72,6 @@ export class Display {
return new Springy.Vector(sx, sy);
};
var fromScreen = function(s) {
var size = currentBB.topright.subtract(currentBB.bottomleft);
var px = (s.x / canvas.width) * size.x + currentBB.bottomleft.x;
var py = (s.y / canvas.height) * size.y + currentBB.bottomleft.y;
return new Springy.Vector(px, py);
};
var renderer = new Springy.Renderer(
this.layout,
() => {
@ -98,22 +92,17 @@ export class Display {
let rad = Math.atan(b / a)
if (negative) rad = rad + Math.PI
if (rad > Math.PI / 2) {
console.warn(negative)
rad += Math.PI
;[p2, p1] = [p1, p2]
} else if (negative) { console.warn(false) }
}
dom.style.transformOrigin = '0 0'
dom.className = 'line'
dom.style.transform = 'rotate(' + rad + 'rad) translateY(-1em)'
dom.style.position = 'absolute'
dom.style.left = p1.x + 'px'
dom.style.top = p1.y + 'px'
dom.style.right = p2.x + 'px'
dom.style.bottom = p2.y + 'px'
dom.style.width = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)) + 'px'
dom.style.height = '1em'
dom.style.borderBottom = '3px solid black'
dom.style.textAlign = 'center'
// FIXME eigentlich falsches parent
field.appendChild(dom)
},
@ -147,7 +136,8 @@ export class Display {
if (state.show !== null) {
const wrapper = document.createElement('a')
wrapper.href = '/'
const fullview = document.createElement('div')
const fullview = document.createElement('img')
fullview.src = '/img/Kartendesign.svg'
wrapper.className = 'fullview'
wrapper.appendChild(fullview)
target.appendChild(wrapper)