123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { SColor, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw/";
- import { SLineEdit } from './../../edit';
- import { SGraphItem } from "@persagy-web/graph";
- import { Marker } from "./../types/Marker";
- import { SMouseEvent } from "@persagy-web/base/lib";
- export class SBaseLineEdit extends SLineEdit {
-
-
-
- data: Marker
-
- startItem: SGraphItem | null = null;
-
- endItem: SGraphItem | null = null;
- constructor(parent: SGraphItem | null, data: Marker) {
- super(parent);
- this.data = data;
- if (data.Style) {
-
- if (data.Style.Line) {
- let setPointList: SPoint[];
- setPointList = data.Style.Line.map(i => {
- return new SPoint(i.X, i.Y)
- });
- this.line = setPointList;
- }
-
- if (data.Style.StrokeColor) {
- this.strokeColor = new SColor(data.Style.StrokeColor)
- }
-
- if (data.Style.LineWidth) {
- this.lineWidth = data.Style.LineWidth
- }
-
- if (data.Style.LineStyle) {
- this.lineStyle = data.Style.LineStyle
- }
- }
- }
-
- onMouseDown(event: SMouseEvent): boolean {
- super.onMouseDown(event)
- return true;
- }
- toData() {
- const Line = [{ X: this.line[0].x, Y: this.line[0].y }, { X: this.line[1].x, Y: this.line[1].y }];
- this.data.Style.Line = Line;
- this.data.Style.StrokeColor = this.strokeColor.value;
- this.data.Style.LineWidth = this.lineWidth;
- this.data.Style.LineStyle = this.lineStyle
- return this.data
- }
- }
|