class GazePoint { constructor(screenX, screenY, createdAt, id) { this.screenX = screenX; this.screenY = screenY; this.createdAt = createdAt; this.id = id || this.createdAt; } linkTo(node) { let bb = node.getBoundingClientRect(), coordinates; if (this.screenX >= bb.left && this.screenX <= bb.right && this.screenY >= bb.top && this.screenY <= bb.bottom) { this.hasLink = true; this.link = node; this.targetX = this.screenX - bb.left; this.targetY = this.screenY - bb.top; } return coordinates; } } export default GazePoint;