You are on page 1of 9

/******/ (function(modules) { // webpackBootstrap

/******/ // The module cache


/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports,
__webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter
});
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module'
});
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value &&
value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value)
__webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return
Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./src/Game/game.ts":
/*!**************************!*\
!*** ./src/Game/game.ts ***!
\**************************/
/*! exports provided: Game */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"Game\", function() { return Game; });\n/*
harmony import */ var _game_utils__WEBPACK_IMPORTED_MODULE_0__ =
__webpack_require__(/*! ./game.utils */ \"./src/Game/game.utils.ts\");\nfunction
_toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) ||
_nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt
to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in
Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return
Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0,
arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nfunction
_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new
TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable =
descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor)
descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction
_createClass(Constructor, protoProps, staticProps) { if (protoProps)
_defineProperties(Constructor.prototype, protoProps); if (staticProps)
_defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj,
key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true,
configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\nvar Game
=\n/*#__PURE__*/\nfunction () {\n function Game() {\n _classCallCheck(this, Game);\n\n
_defineProperty(this, \"observers\", void 0);\n\n _defineProperty(this, \"state\", void 0);\n\n
this.observers = [];\n this.state = {\n points: [],\n gameArea: {\n width: 0,\n height:
0\n },\n shapes: {},\n areas: {}\n };\n }\n\n _createClass(Game, [{\n key:
\"addPoint\",\n value: function addPoint(point) {\n if
(!_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"isValidPoint\"](point,
this.state.gameArea)) {\n return;\n }\n\n var points = this.state.points;\n\n if
(points.length < 3) {\n points.push(point);\n } else {\n var nearestPoint =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getIndexNearestPoint\"](point,
points);\n points[nearestPoint] = point;\n }\n\n this.missingPoint();\n
this.calculateShapes();\n this.notify();\n }\n }, {\n key: \"setGameArea\",\n value: function
setGameArea(gameArea) {\n var _this = this;\n\n this.state.gameArea = gameArea;\n
this.state.points = this.state.points.filter(function (point) {\n return
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"isValidPoint\"](point,
_this.state.gameArea);\n });\n this.missingPoint();\n this.calculateShapes();\n
this.notify();\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.state = {\n
gameArea: this.state.gameArea,\n points: [],\n shapes: {},\n areas: {}\n };\n
this.notify();\n }\n }, {\n key: \"missingPoint\",\n value: function missingPoint() {\n var
_this2 = this;\n\n if (this.state.points.length === 3) {\n var missingPoints =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getMissingPoints\"](this.state.points).fil
ter(function (point) {\n return
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"isValidPoint\"](point,
_this2.state.gameArea);\n });\n var nearestPoint =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getIndexNearestPoint\"]([0, 0],
missingPoints);\n this.state.missingPoint = missingPoints[nearestPoint];\n } else {\n
this.state.missingPoint = undefined;\n }\n }\n }, {\n key: \"calculateShapes\",\n value:
function calculateShapes() {\n this.calculateParallelogram();\n this.calculateCircle();\n }\n
}, {\n key: \"calculateCircle\",\n value: function calculateCircle() {\n var _this$state =
this.state,\n points = _this$state.points,\n missingPoint = _this$state.missingPoint,\n
areas = _this$state.areas;\n\n if (points.length !== 3 || !missingPoint || !areas.parallelogram) {\n
this.state.shapes.circle = undefined;\n return;\n }\n\n var allPoints =
[].concat(_toConsumableArray(points), [missingPoint]);\n var center =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getPolygonCenter\"](allPoints);\n
var radius =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getCircleRadius\"](areas.parallelogram)
;\n this.state.shapes.circle = {\n center: center,\n radius: radius\n };\n
this.state.areas.circle = areas.parallelogram;\n }\n }, {\n key: \"calculateParallelogram\",\n
value: function calculateParallelogram() {\n var _this$state2 = this.state,\n points =
_this$state2.points,\n missingPoint = _this$state2.missingPoint;\n\n if (points.length !== 3
|| !missingPoint) {\n this.state.shapes.parallelogram = undefined;\n return;\n }\n\n
var allPoints = [].concat(_toConsumableArray(points), [missingPoint]);\n var center =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getPolygonCenter\"](allPoints);\n
var nearestDistance =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"distance\"](center, allPoints[0]) + 1;\n
var logestsDistance =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"distance\"](center, allPoints[0]) - 1;\n
var logestsPoints = [];\n var nearestPoint = [];\n allPoints.map(function (point) {\n var
distance = _game_utils__WEBPACK_IMPORTED_MODULE_0__[\"distance\"](center, point);\n\n
if (nearestDistance > distance) {\n nearestDistance = distance;\n }\n\n if
(logestsDistance < distance) {\n logestsDistance = distance;\n }\n\n return point;\n
}).forEach(function (point) {\n var distance =
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"distance\"](center, point);\n\n if
(distance === logestsDistance) {\n logestsPoints.push(point);\n }\n\n if (distance ===
nearestDistance) {\n nearestPoint.push(point);\n }\n });\n
this.state.shapes.parallelogram = [logestsPoints[0], nearestPoint[0], logestsPoints[1],
nearestPoint[1]];\n this.state.areas.parallelogram = !!this.state.shapes.parallelogram ?
_game_utils__WEBPACK_IMPORTED_MODULE_0__[\"getPolygonArea\"](this.state.shapes.par
allelogram) : undefined;\n }\n }, {\n key: \"subscribe\",\n value: function subscribe(action)
{\n this.observers.push(action);\n }\n }, {\n key: \"unsubscribe\",\n value: function
unsubscribe(action) {\n this.observers = this.observers.filter(function (subscriber) {\n return
subscriber !== action;\n });\n }\n }, {\n key: \"notify\",\n value: function notify() {\n
var _this3 = this;\n\n this.observers.forEach(function (observer) {\n return
observer(_this3.state);\n });\n }\n }]);\n\n return Game;\n}();\n\n//#
sourceURL=webpack:///./src/Game/game.ts?");

/***/ }),

/***/ "./src/Game/game.utils.ts":
/*!********************************!*\
!*** ./src/Game/game.utils.ts ***!
\********************************/
/*! exports provided: distance, getMissingPoints, isValidPoint, getIndexNearestPoint,
getIndexLongestPoint, getPolygonArea, getPolygonCenter, getCircleRadius */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"distance\", function() { return distance; });\n/*
harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMissingPoints\",
function() { return getMissingPoints; });\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"isValidPoint\", function() { return isValidPoint;
});\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
\"getIndexNearestPoint\", function() { return getIndexNearestPoint; });\n/* harmony export
(binding) */ __webpack_require__.d(__webpack_exports__, \"getIndexLongestPoint\", function() {
return getIndexLongestPoint; });\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"getPolygonArea\", function() { return
getPolygonArea; });\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"getPolygonCenter\", function() { return
getPolygonCenter; });\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"getCircleRadius\", function() { return
getCircleRadius; });\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) ||
_iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new
TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction
_iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) ||
Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n =
true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s =
_i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) {
_d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if
(_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return
arr; }\n\nvar distance = function distance(pointA, pointB) {\n var _pointA =
_slicedToArray(pointA, 2),\n x1 = _pointA[0],\n y1 = _pointA[1];\n\n var _pointB =
_slicedToArray(pointB, 2),\n x2 = _pointB[0],\n y2 = _pointB[1];\n\n var a = x1 - x2;\n var
b = y1 - y2;\n return Math.sqrt(a * a + b * b);\n};\nvar getMissingPoints = function
getMissingPoints(points) {\n var calculate = function calculate(a1, b1, c1) {\n return [a1[0] +
(c1[0] - b1[0]), a1[1] + (c1[1] - b1[1])];\n };\n\n var _points = _slicedToArray(points, 3),\n a=
_points[0],\n b = _points[1],\n c = _points[2];\n\n return [calculate(a, b, c), calculate(a, c, b),
calculate(b, a, c), calculate(b, c, a), calculate(c, a, b), calculate(c, b, a)];\n};\nvar isValidPoint =
function isValidPoint(point, gameArea) {\n return point[0] <= gameArea.width && point[1] <=
gameArea.height && point[0] >= 0 && point[1] >= 0;\n};\nvar getIndexNearestPoint = function
getIndexNearestPoint(origin, points) {\n return points.map(function (point) {\n return
distance(origin, point);\n }).reduce(function (nearestIndex, currentDistance, currentIndex,
distances) {\n return distances[nearestIndex] > currentDistance ? currentIndex : nearestIndex;\n
}, 0);\n};\nvar getIndexLongestPoint = function getIndexLongestPoint(origin, points) {\n return
points.map(function (point) {\n return distance(origin, point);\n }).reduce(function
(LongestIndex, currentDistance, currentIndex, distances) {\n return distances[LongestIndex] <
currentDistance ? currentIndex : LongestIndex;\n }, 0);\n};\nvar getPolygonArea = function
getPolygonArea(points) {\n var total = 0;\n\n for (var i = 0, l = points.length; i < l; i++) {\n var
addX = points[i][0];\n var addY = points[i === points.length - 1 ? 0 : i + 1][1];\n var subX =
points[i === points.length - 1 ? 0 : i + 1][0];\n var subY = points[i][1];\n total += addX * addY *
0.5;\n total -= subX * subY * 0.5;\n }\n\n return Math.abs(total);\n};\nvar getPolygonCenter =
function getPolygonCenter(points) {\n return points.reduce(function (center, point) {\n center[0]
+= point[0] / points.length;\n center[1] += point[1] / points.length;\n return center;\n }, [0,
0]);\n};\nvar getCircleRadius = function getCircleRadius(area) {\n return Math.sqrt(area /
Math.PI);\n};\n\n//# sourceURL=webpack:///./src/Game/game.utils.ts?");

/***/ }),

/***/ "./src/Game/index.ts":
/*!***************************!*\
!*** ./src/Game/index.ts ***!
\***************************/
/*! exports provided: Game */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var
_game__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./game */
\"./src/Game/game.ts\");\n/* harmony reexport (safe) */
__webpack_require__.d(__webpack_exports__, \"Game\", function() { return
_game__WEBPACK_IMPORTED_MODULE_0__[\"Game\"]; });\n\n\n\n//#
sourceURL=webpack:///./src/Game/index.ts?");

/***/ }),

/***/ "./src/draws/clear.ts":
/*!****************************!*\
!*** ./src/draws/clear.ts ***!
\****************************/
/*! exports provided: clear */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"clear\", function() { return clear; });\nvar clear =
function clear(canvas) {\n var context = canvas.getContext('2d');\n\n if (context) {\n
context.clearRect(0, 0, canvas.width, canvas.height);\n }\n};\n\n//#
sourceURL=webpack:///./src/draws/clear.ts?");

/***/ }),

/***/ "./src/draws/index.ts":
/*!****************************!*\
!*** ./src/draws/index.ts ***!
\****************************/
/*! exports provided: clear, circle, polygon */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var
_clear__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clear */
\"./src/draws/clear.ts\");\n/* harmony reexport (safe) */
__webpack_require__.d(__webpack_exports__, \"clear\", function() { return
_clear__WEBPACK_IMPORTED_MODULE_0__[\"clear\"]; });\n\n/* harmony import */ var
_shapes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shapes */
\"./src/draws/shapes.ts\");\n/* harmony reexport (safe) */
__webpack_require__.d(__webpack_exports__, \"circle\", function() { return
_shapes__WEBPACK_IMPORTED_MODULE_1__[\"circle\"]; });\n\n/* harmony reexport (safe)
*/ __webpack_require__.d(__webpack_exports__, \"polygon\", function() { return
_shapes__WEBPACK_IMPORTED_MODULE_1__[\"polygon\"]; });\n\n\n\n\n//#
sourceURL=webpack:///./src/draws/index.ts?");

/***/ }),

/***/ "./src/draws/shapes.ts":
/*!*****************************!*\
!*** ./src/draws/shapes.ts ***!
\*****************************/
/*! exports provided: circle, polygon */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"circle\", function() { return circle; });\n/*
harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"polygon\",
function() { return polygon; });\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) ||
_iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new
TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction
_iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) ||
Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n =
true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s =
_i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) {
_d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if
(_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return
arr; }\n\nvar circle = function circle(canvas, center, radius, color) {\n var _center =
_slicedToArray(center, 2),\n x = _center[0],\n y = _center[1];\n\n var ctx =
canvas.getContext('2d');\n\n if (ctx) {\n ctx.beginPath();\n ctx.arc(x, y, radius, 0, Math.PI *
2);\n ctx.strokeStyle = color;\n ctx.stroke();\n }\n};\nvar polygon = function polygon(canvas,
points, color) {\n var ctx = canvas.getContext('2d');\n\n if (ctx) {\n ctx.beginPath();\n
points.forEach(function (point, index) {\n var _point = _slicedToArray(point, 2),\n x=
_point[0],\n y = _point[1];\n\n if (index === 0) {\n ctx.moveTo(x, y);\n } else {\n
ctx.lineTo(x, y);\n }\n });\n ctx.closePath();\n ctx.strokeStyle = color;\n ctx.stroke();\n
}\n};\n\n//# sourceURL=webpack:///./src/draws/shapes.ts?");

/***/ }),

/***/ "./src/handles/index.ts":
/*!******************************!*\
!*** ./src/handles/index.ts ***!
\******************************/
/*! exports provided: mousePosition */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var
_mousePosition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*!
./mousePosition */ \"./src/handles/mousePosition.ts\");\n/* harmony reexport (safe) */
__webpack_require__.d(__webpack_exports__, \"mousePosition\", function() { return
_mousePosition__WEBPACK_IMPORTED_MODULE_0__[\"mousePosition\"]; });\n\n\n\n//#
sourceURL=webpack:///./src/handles/index.ts?");

/***/ }),

/***/ "./src/handles/mousePosition.ts":
/*!**************************************!*\
!*** ./src/handles/mousePosition.ts ***!
\**************************************/
/*! exports provided: mousePosition */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, \"mousePosition\", function() { return
mousePosition; });\nvar mousePosition = function mousePosition(clickEvent) {\n var x =
clickEvent.pageX;\n var y = clickEvent.pageY; // IE 8\n\n if (x === undefined) {\n x =
clickEvent.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;\n y =
clickEvent.clientY + document.body.scrollTop + document.documentElement.scrollTop;\n }\n\n
return [x, y];\n};\n\n//# sourceURL=webpack:///./src/handles/mousePosition.ts?");

/***/ }),

/***/ "./src/index.ts":
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var
_handles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./handles */
\"./src/handles/index.ts\");\n/* harmony import */ var
_Game__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Game */
\"./src/Game/index.ts\");\n/* harmony import */ var
_draws__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./draws */
\"./src/draws/index.ts\");\n/* harmony import */ var
_style_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style.scss */
\"./src/style.scss\");\n/* harmony import */ var
_style_scss__WEBPACK_IMPORTED_MODULE_3___default =
/*#__PURE__*/__webpack_require__.n(_style_scss__WEBPACK_IMPORTED_MODULE_3__);\
n\n\n // tslint:disable-next-line: no-import-side-effect\n\n\n\nvar getGameArea = function
getGameArea() {\n return {\n height: document.body.clientHeight - 40,\n width:
document.body.clientWidth\n };\n};\n\nvar game = new
_Game__WEBPACK_IMPORTED_MODULE_1__[\"Game\"]();\nvar canvas =
document.getElementById('canvas');\nvar infos = document.getElementById('infos');\nvar reset =
document.getElementById('reset');\nvar displayInfos =
document.getElementById('displayInfos');\nvar about = document.getElementById('about');\nvar
alert = document.getElementById('alert');\n\nvar resize = function resize() {\n var gameArea =
getGameArea();\n var height = gameArea.height,\n width = gameArea.width;\n canvas.width =
width;\n canvas.height = height;\n game.setGameArea(gameArea);\n};\n\nresize();\n\nvar draw =
function draw(gameState) {\n
_draws__WEBPACK_IMPORTED_MODULE_2__[\"clear\"](canvas);\n var points =
gameState.points,\n shapes = gameState.shapes;\n points.forEach(function (point) {\n
_draws__WEBPACK_IMPORTED_MODULE_2__[\"circle\"](canvas, point, 10.5, 'red');\n });\n\n
if (shapes.circle) {\n var circle = shapes.circle;\n
_draws__WEBPACK_IMPORTED_MODULE_2__[\"circle\"](canvas, circle.center, circle.radius,
'yellow');\n }\n\n if (shapes.parallelogram) {\n var parallelogram = shapes.parallelogram;\n
_draws__WEBPACK_IMPORTED_MODULE_2__[\"polygon\"](canvas, parallelogram, 'blue');\n
}\n};\n\nvar fillInfos = function fillInfos(gameState) {\n var points = gameState.points,\n areas
= gameState.areas,\n circle = gameState.shapes.circle;\n var html = points.map(function (point)
{\n return \"\".concat(point[0], \", \").concat(point[1]);\n }).map(function (point, index) {\n
return \"<span class=\\\"label\\\"><strong>Point \".concat(index + 1, \":</strong> \").concat(point,
\"</span>\");\n }).join('');\n\n if (areas.parallelogram) {\n html += \"<span
class=\\\"label\\\"><strong>Parallelogram Area:</strong> \".concat(areas.parallelogram,
\"</span>\");\n }\n\n if (circle) {\n html += \"<span class=\\\"label\\\"><strong>Circle
Radius:</strong> \".concat(circle.radius, \"</span>\");\n }\n\n infos.innerHTML =
html;\n};\n\nvar showInfos = function showInfos() {\n var hidden = infos.style.visibility ===
'hidden';\n\n if (!hidden) {\n infos.classList.add('show');\n setTimeout(function () {\n
infos.classList.remove('show');\n }, 3000);\n }\n};\n\ncanvas.addEventListener('click', function
(event) {\n var point =
Object(_handles__WEBPACK_IMPORTED_MODULE_0__[\"mousePosition\"])(event);\n
game.addPoint(point);\n});\nwindow.addEventListener('resize',
resize);\nreset.addEventListener('click', function (event) {\n
game.reset();\n});\ndisplayInfos.addEventListener('click',
showInfos);\nabout.addEventListener('click', function (event) {\n alert.style.visibility =
'visible';\n});\nalert.addEventListener('click', function (event) {\n alert.style.visibility =
'hidden';\n});\ngame.subscribe(draw);\ngame.subscribe(fillInfos);\n\n//#
sourceURL=webpack:///./src/index.ts?");

/***/ }),

/***/ "./src/style.scss":
/*!************************!*\
!*** ./src/style.scss ***!
\************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./src/style.scss?");

/***/ })

/******/ });

You might also like