UNPKG

alecmce-primitivesjs

Version:

A small library for visualizing the prime factor decomposition of numbers.

29 lines (28 loc) 1.06 kB
"use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var Two = (function () { function Two(drawCircle, color, padding, child) { this.drawCircle = drawCircle; this.color = color; this.padding = padding; this.child = child; this.radius = (4 * child.radius + 3 * padding) / 2; } Two.prototype.draw = function (config) { var offset = this.child.radius + this.padding / 2; var container = this.drawCircle(__assign({}, config, { radius: this.radius, color: this.color, stroke: true })); this.child.draw({ container: container, x: +offset, y: 0 }); this.child.draw({ container: container, x: -offset, y: 0 }); return container; }; return Two; }()); exports.Two = Two;