"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SGraphLineItem = void 0; const lib_1 = require("@persagy-web/draw/lib"); const SGraphItem_1 = require("../SGraphItem"); class SGraphLineItem extends SGraphItem_1.SGraphItem { constructor(parent, x1, y1, x2, y2, color = lib_1.SColor.Black, width = 1) { super(parent); this.color = lib_1.SColor.Black; this.width = 1; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } boundingRect() { let minX = Math.min(this.x1, this.x2); let minY = Math.min(this.y1, this.y2); let maxX = Math.max(this.x1, this.x2); let maxY = Math.max(this.y1, this.y2); return new lib_1.SRect(minX - this.width / 2, minY - this.width / 2, maxX - minX + this.width, maxY - minY + this.width); } onDraw(painter) { painter.pen = new lib_1.SPen(this.color, this.width); painter.drawLine(this.x1, this.y1, this.x2, this.y2); } } exports.SGraphLineItem = SGraphLineItem;