|
@ -78,10 +78,11 @@ export class Display { |
|
|
let currentBB = this.layout.getBoundingBox() |
|
|
let currentBB = this.layout.getBoundingBox() |
|
|
let width = this.target.scrollWidth || 100 |
|
|
let width = this.target.scrollWidth || 100 |
|
|
let height = this.target.scrollHeight || 100 |
|
|
let height = this.target.scrollHeight || 100 |
|
|
|
|
|
const ballRadius = Math.min(document.body.clientWidth, document.body.clientHeight) * 0.06 |
|
|
var toScreen = function(p) { |
|
|
var toScreen = function(p) { |
|
|
var size = currentBB.topright.subtract(currentBB.bottomleft); |
|
|
var size = currentBB.topright.subtract(currentBB.bottomleft); |
|
|
var sx = p.subtract(currentBB.bottomleft).divide(size.x).x * (width - 60) + 30; |
|
|
|
|
|
var sy = p.subtract(currentBB.bottomleft).divide(size.y).y * (height - 60) + 30; |
|
|
|
|
|
|
|
|
var sx = p.subtract(currentBB.bottomleft).divide(size.x).x * (width - ballRadius * 2) + ballRadius; |
|
|
|
|
|
var sy = p.subtract(currentBB.bottomleft).divide(size.y).y * (height - ballRadius * 2) + ballRadius; |
|
|
return new Springy.Vector(sx, sy); |
|
|
return new Springy.Vector(sx, sy); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -133,8 +134,8 @@ export class Display { |
|
|
} |
|
|
} |
|
|
dom.className = item.data.state |
|
|
dom.className = item.data.state |
|
|
dom.style.position = 'absolute' |
|
|
dom.style.position = 'absolute' |
|
|
dom.style.left = (target.x - 60) + 'px' |
|
|
|
|
|
dom.style.top = (target.y - 60) + 'px' |
|
|
|
|
|
|
|
|
dom.style.left = (target.x - ballRadius) + 'px' |
|
|
|
|
|
dom.style.top = (target.y - ballRadius) + 'px' |
|
|
dom.appendChild(a) |
|
|
dom.appendChild(a) |
|
|
field.appendChild(dom) |
|
|
field.appendChild(dom) |
|
|
}, undefined, undefined, |
|
|
}, undefined, undefined, |
|
|