123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import { SGraphStyleItem, SGraphItem, SLineStyle } from "@persagy-web/graph"
- import { SPainter, SColor, SFont, SPoint } from "@persagy-web/draw";
- export class SCircleItem extends SGraphStyleItem {
-
- set localtion(v) {
- this._localtion = new SPoint(v);
- this.update()
- }
- get localtion(): SPoint {
- return this._localtion
- }
- _localtion: SPoint = new SPoint(0, 0);
-
- set radius(v: number) {
- this._radius = v;
- this.update();
- }
- get radius(): number {
- return this._radius
- }
- _radius: number = 0;
-
- constructor(parent: SGraphItem | null) {
- super(parent)
- }
-
- onDraw(painter: SPainter): void {
- painter.pen.color = this.strokeColor;
- painter.brush.color = this.fillColor;
- painter.pen.lineWidth = this.lineWidth;
- if (this.lineStyle == SLineStyle.Dashed) {
- painter.pen.lineDash = [
- painter.toPx(this.lineWidth * 3),
- painter.toPx(this.lineWidth * 7)
- ];
- } else if (this.lineStyle == SLineStyle.Dotted) {
- painter.pen.lineDash = [
- painter.toPx(this.lineWidth * 2),
- painter.toPx(this.lineWidth * 2)
- ];
- }
- painter.drawCircle(this.localtion.x, this.localtion.y, this.radius);
- }
- }
|