@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
41 lines (33 loc) • 755 B
JavaScript
export class ConnectionEndpointLayoutSpec {
/**
*
* @type {BoxLayoutSpec}
*/
box = null;
/**
* Local offset inside the box where connection is attached
* @type {Vector2}
*/
point = null;
/**
*
* @param {Vector2} result
*/
computePosition(result) {
result.set(
this.point.x + this.box.x0,
this.point.y + this.box.y0
);
}
/**
* @param {AABB2} box
* @param {Vector2} point
* @returns {ConnectionEndpointLayoutSpec}
*/
static from(box, point) {
const r = new ConnectionEndpointLayoutSpec();
r.box = box;
r.point = point;
return r;
}
}