UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

12 lines (10 loc) 414 B
function getDistance(a, b) { return Math.abs(a - b); } function setPositionDir(target, pos, dir) { const center = target.translateToCenterPoint(pos, 'center', 'center'); const position = target.translateToOriginPoint(center, target.originX, target.originY); if (dir == 'x') target.setX(position.x);else target.setY(position.y); } export { getDistance, setPositionDir }; //# sourceMappingURL=basic.mjs.map