"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CircleWarp = void 0; const tsparticles_engine_1 = require("tsparticles-engine"); class CircleWarp extends tsparticles_engine_1.Circle { constructor(x, y, radius, canvasSize) { super(x, y, radius); this.canvasSize = canvasSize; this.canvasSize = Object.assign({}, canvasSize); } contains(point) { if (super.contains(point)) { return true; } const posNE = { x: point.x - this.canvasSize.width, y: point.y, }; if (super.contains(posNE)) { return true; } const posSE = { x: point.x - this.canvasSize.width, y: point.y - this.canvasSize.height, }; if (super.contains(posSE)) { return true; } const posSW = { x: point.x, y: point.y - this.canvasSize.height, }; return super.contains(posSW); } intersects(range) { if (super.intersects(range)) { return true; } const rect = range, circle = range, newPos = { x: range.position.x - this.canvasSize.width, y: range.position.y - this.canvasSize.height, }; if (circle.radius !== undefined) { const biggerCircle = new tsparticles_engine_1.Circle(newPos.x, newPos.y, circle.radius * 2); return super.intersects(biggerCircle); } else if (rect.size !== undefined) { const rectSW = new tsparticles_engine_1.Rectangle(newPos.x, newPos.y, rect.size.width * 2, rect.size.height * 2); return super.intersects(rectSW); } return false; } } exports.CircleWarp = CircleWarp;