123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import { SMouseEvent } from "@persagy-web/base";
- import { SEquipItem } from "@persagy-web/big"
- import { SGraphItem, STextItem, SGraphCircleItem } from "@persagy-web/graph/lib";
- import { SColor, SFont, SPoint } from "@persagy-web/draw/lib";
- import { SCircleItem } from "./SCircleItem"
- export class EquipItem extends SEquipItem {
- StatusPoint: SCircleItem | null = null;
- constructor(parent: SGraphItem | null) {
- super(parent);
- }
-
- setEquipName() {
- const item = new STextItem(this);
- item.text = this.data.properties.localName;
-
- item.color = new SColor('#6b7086')
- item.font = new SFont("sans-serif", 16);
- item.isTransform = false;
-
- item.moveTo(-this.width / 2, this.height / 2 +16 );
- this.setStatusPoint(item)
- }
-
- setStatusPoint(parent: STextItem | null) {
- const item = new SCircleItem(parent);
- const h = parent ? parent.height : 0
- item.localtion = new SPoint(0, 0);
- item.radius = 4;
- item.fillColor = new SColor('#de6466');
- item.strokeColor = new SColor('#de6466')
- item.moveTo(-item.radius * 2, h)
- this.StatusPoint = item;
- }
-
- setStatusPointColor(val: string) {
- if (!this.StatusPoint) return;
- this.StatusPoint.fillColor = new SColor(val);
- this.StatusPoint.strokeColor = new SColor(val);
- }
-
- getMsgList(): any {
- return this.textItemList
- }
- onMouseMove(event:SMouseEvent):boolean{
- const scene = this.scene;
- if (null != scene) {
- if (scene.hoverItem == null || scene.hoverItem !== this) {
- if (scene.hoverItem != null) {
- scene.hoverItem.onMouseLeave(event);
- }
- this.onMouseEnter(event);
- scene.hoverItem = this;
- }
- }
- return true
- }
-
- onMouseEnter(event: SMouseEvent): boolean {
- this.$emit("onMouseEnter");
- return false;
- }
-
- onMouseLeave(event: SMouseEvent): boolean {
- this.$emit("onMouseLeave");
- return false;
- }
- }
|