/* * ******************************************************************************************************************** * * :*$@@%$*: ;: ;; ;; * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@ * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$ * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$= * =@* %! @ $= % %@= =%@! %= * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =% * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%* * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$ * $@* ;@@@%=!: *@* * =@$ ;;;!=%@@@@=! =@! * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司 * ;%@@$=$@@%* *@@@$=%@@%; * ::;:: ::;:: All rights reserved. * * ******************************************************************************************************************** */ import { SGraphItem } from "@saga-web/graph/lib"; import { SColor, SLine, SPoint, SRect } from "@saga-web/draw/lib"; import { ItemOrder, ItemColor } from '@saga-web/big/lib'; /** * 吸附时高亮对象 * * @author 郝建龙 */ export class HighlightItem extends SGraphItem { /** * 构造函数 * * @param parent 指向父对象 */ constructor(parent) { super(parent); /** 对象与鼠标位置距离 */ this.distance = 0; /** 对象类型 */ this.type = 1; /** 点对象数据-当吸附的为线时,此点为垂线与线段的交点 */ this._point = new SPoint(); /** 点对象数据 */ this._line = new SLine(); this.visible = false; this.zOrder = ItemOrder.highLightOrder; } // Constructor get point() { return this._point; } // Get point set point(v) { this._point = v; this.type = 1; this.update(); } // Set point get line() { return this._line; } // Get line set line(v) { this._line = v; this.type = 2; this.update(); } // Set line /** * Item对象边界区域 * * @return SRect */ boundingRect() { return new SRect(this.point.x, this.point.y, 10, 10); } // Function boundingRect() /** * Item绘制操作 * * @param painter painter对象 */ onDraw(painter) { if (this.type == 2) { painter.pen.color = ItemColor.highLightLineColor; painter.pen.lineWidth = painter.toPx(6); painter.drawLine(this.line); } painter.pen.color = SColor.Transparent; painter.brush.color = ItemColor.highLightPointColor; painter.drawCircle(this.point.x, this.point.y, painter.toPx(5)); } // Function onDraw() } // Class HighlightItem