diff --git a/debug.log b/debug.log index de4e5cb..9b723ca 100644 --- a/debug.log +++ b/debug.log @@ -9,3 +9,7 @@ [0108/092244.401:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) [0108/100658.746:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) [0109/083452.962:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) +[0111/084621.230:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) +[0111/102545.331:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) +[0112/084413.518:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) +[0112/152359.453:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3) diff --git a/src/app/working-area/model/axArrowConnector.ts b/src/app/working-area/model/axArrowConnector.ts index 6ed0dd9..6c53382 100644 --- a/src/app/working-area/model/axArrowConnector.ts +++ b/src/app/working-area/model/axArrowConnector.ts @@ -9,7 +9,7 @@ import { GameMode } from './gameMode'; */ export class AxArrowConnector extends AxShape { pointSprites: Array = new Array(); - line: PIXI.Graphics; + tempLine: PIXI.Graphics; text: PIXI.Text; style = new PIXI.TextStyle({ fontFamily: 'Arial', @@ -42,9 +42,9 @@ export class AxArrowConnector extends AxShape { + '\r\n' + this.assetData.PropertyInfos?.find((item: { PropertyName: string; }) => item.PropertyName === '鍚嶇О/缂栧彿')?.PropertyValue, this.style); - this.line = new PIXI.Graphics(); + this.tempLine = new PIXI.Graphics(); this.addChild(this.text); - this.addChild(this.line); + this.addChild(this.tempLine); this.workingArea.backgroundImage.addChild(this); this.refresh(); this.drawPoints(); @@ -127,11 +127,21 @@ export class AxArrowConnector extends AxShape { this.text.visible = value; } } + /** + * + * @param scale 缁樺埗杈规 + */ + public drawBorder(scale: number) { + let visible = this.pointSprites[0].visible; + this.setPointVisiable(false); + super.drawBorder(scale); + this.setPointVisiable(visible); + } /** * 鍒锋柊褰㈢姸 */ public refresh(): void { - const c = this.line; + const c = this.tempLine; const pts = this.assetData.MultiPoint; if (pts.length < 2) { return; diff --git a/src/app/working-area/model/axLegend.ts b/src/app/working-area/model/axLegend.ts index 55f4d8f..56a67c5 100644 --- a/src/app/working-area/model/axLegend.ts +++ b/src/app/working-area/model/axLegend.ts @@ -1,4 +1,6 @@ import { Constructor } from '@angular/material/core/common-behaviors/constructor'; +import { MatGridTileHeaderCssMatStyler } from '@angular/material/grid-list'; +import { DefaultProxy } from 'cesium'; import { Sprite, Texture,Text, Graphics, Point } from 'pixi.js'; import { WorkingAreaComponent } from '../working-area.component'; import { AxShape } from './axShape'; @@ -10,6 +12,14 @@ export class AxLegend extends AxShape { // 鏁版嵁 public shapeMap: Map = new Map(); pen: Graphics = new Graphics(); + // up: Sprite = new Sprite(this.pointTexture); + // down: Sprite= new Sprite(this.pointTexture); + // left: Sprite= new Sprite(this.pointTexture); + // right: Sprite= new Sprite(this.pointTexture); + upLeft: Sprite= new Sprite(this.pointTexture); + upRight: Sprite= new Sprite(this.pointTexture); + downLeft: Sprite= new Sprite(this.pointTexture); + downRight: Sprite= new Sprite(this.pointTexture); /** * */ @@ -17,7 +27,12 @@ export class AxLegend extends AxShape { super(assetData, workingArea); this.angle = -this.workingArea.backgroundImage.angle; this.name = this.assetData.Id; + this.pivot.set(this.assetData.PivotX, this.assetData.PivotY); + this.x = this.assetData.Point.x; + this.y = this.assetData.Point.y; + this.scale.set(this.assetData.Scale); this.shapeMap = shapeMap; + this.createPoint(); this.refresh(); } // 娣诲姞鏁版嵁 @@ -101,7 +116,331 @@ export class AxLegend extends AxShape { this.pen.endFill(); } this.addChild(this.pen); + // 娣诲姞border + this.addChild(this.border); + // 娣诲姞鎺у埗鐐 + this.addChild(this.upLeft); + this.addChild(this.upRight); + this.addChild(this.downLeft); + this.addChild(this.downRight); + + this.angle = -this.workingArea.backgroundImage.angle; + this.drawBorder(1 / this.workingArea.backgroundImage.scale.x); + } + public createPoint() { + // this.addChild(this.upLeft); + this.upLeft.anchor.set(0.5); + this.upLeft.interactive = true; + this.upLeft.visible = false; + this.upLeft + .on('pointerdown', event => { + event.stopPropagation(); + event.currentTarget.data = event.data; + event.currentTarget.alpha = 0.5; + event.currentTarget.dragging = true; + + event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); + + var pointStart = this.position; + var pointEnd = this.workingArea.backgroundImage.toLocal(this.toGlobal(this.downRight.position)); + + const delX = pointEnd.x - pointStart.x; + const delY = pointEnd.y - pointStart.y; + + this.pivot.set(this.downRight.x, this.downRight.y); + + this.position.x += delX; + this.position.y += delY; + + this.assetData.PivotX = this.pivot.x; + this.assetData.PivotY = this.pivot.y; + this.assetData.Point = new Point(this.x, this.y); + }) + .on('pointerup', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointerupoutside', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointermove', event => { + if (event.currentTarget.dragging) { + const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); + var startPos = this.position; + var endPos = this.workingArea.backgroundImage.toLocal(this.toGlobal(newPosition)); + var width = (endPos.x - startPos.x); + var height = (endPos.y - startPos.y); + var scaleX = width / (this.width / this.scale.x); + var scaleY = height / (this.width / this.scale.x); + var angle = Math.abs(this.angle); + console.log(angle); + if (angle === 0) { + this.scale.set(-scaleX); + } else if (angle === 90) { + this.scale.set(scaleY); + } else if (angle === 180) { + this.scale.set(scaleX); + } else if (angle === 270) { + this.scale.set(-scaleY); + } + this.assetData.Scale = this.scale.x; + } + }) + .on('rightclick', event => { + this.border.visible = false; + }); + // this.addChild(this.upRight); + this.upRight.anchor.set(0.5); + this.upRight.interactive = true; + this.upRight.visible = false; + this.upRight + .on('pointerdown', event => { + event.stopPropagation(); + event.currentTarget.data = event.data; + event.currentTarget.alpha = 0.5; + event.currentTarget.dragging = true; + + event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); + + var pointStart = this.position; + var pointEnd = this.workingArea.backgroundImage.toLocal(this.toGlobal(this.downLeft.position)); + + const delX = pointEnd.x - pointStart.x; + const delY = pointEnd.y - pointStart.y; + + this.pivot.set(this.downLeft.x, this.downLeft.y); + + this.position.x += delX; + this.position.y += delY; + + this.assetData.PivotX = this.pivot.x; + this.assetData.PivotY = this.pivot.y; + this.assetData.Point = new Point(this.x, this.y); + }) + .on('pointerup', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointerupoutside', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointermove', event => { + if (event.currentTarget.dragging) { + const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); + var startPos = this.position; + var endPos = this.workingArea.backgroundImage.toLocal(this.toGlobal(newPosition)); + var width = (endPos.x - startPos.x); + var height = (endPos.y - startPos.y); + var scaleX = width / (this.width / this.scale.x); + var scaleY = height / (this.width / this.scale.x); + var angle = Math.abs(this.angle); + console.log(angle); + if (angle === 0) { + this.scale.set(scaleX); + } else if (angle === 90) { + this.scale.set(-scaleY); + } else if (angle === 180) { + this.scale.set(-scaleX); + } else if (angle === 270) { + this.scale.set(scaleY); + } + this.assetData.Scale = this.scale.x; + } + }) + .on('rightclick', event => { + this.border.visible = false; + }); + // this.addChild(this.downLeft); + this.downLeft.anchor.set(0.5); + this.downLeft.interactive = true; + this.downLeft.visible = false; + this.downLeft + .on('pointerdown', event => { + event.stopPropagation(); + event.currentTarget.data = event.data; + event.currentTarget.alpha = 0.5; + event.currentTarget.dragging = true; + + event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); + + var pointStart = this.position; + var pointEnd = this.workingArea.backgroundImage.toLocal(this.toGlobal(this.upRight.position)); + + const delX = pointEnd.x - pointStart.x; + const delY = pointEnd.y - pointStart.y; + + this.pivot.set(this.upRight.x, this.upRight.y); + + this.position.x += delX; + this.position.y += delY; + + this.assetData.PivotX = this.pivot.x; + this.assetData.PivotY = this.pivot.y; + this.assetData.Point = new Point(this.x, this.y); + }) + .on('pointerup', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointerupoutside', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointermove', event => { + if (event.currentTarget.dragging) { + const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); + var startPos = this.position; + var endPos = this.workingArea.backgroundImage.toLocal(this.toGlobal(newPosition)); + var width = (endPos.x - startPos.x); + var height = (endPos.y - startPos.y); + var scaleX = width / (this.width / this.scale.x); + var scaleY = height / (this.width / this.scale.x); + var angle = Math.abs(this.angle); + console.log(angle); + if (angle === 0) { + this.scale.set(-scaleX); + } else if (angle === 90) { + this.scale.set(scaleY); + } else if (angle === 180) { + this.scale.set(scaleX); + } else if (angle === 270) { + this.scale.set(-scaleY); + } + this.assetData.Scale = this.scale.x; + } + }) + .on('rightclick', event => { + this.border.visible = false; + }); + // this.addChild(this.downRight); + this.downRight.anchor.set(0.5); + this.downRight.interactive = true; + this.downRight.visible = false; + this.downRight + .on('pointerdown', event => { + event.stopPropagation(); + event.currentTarget.data = event.data; + event.currentTarget.alpha = 0.5; + event.currentTarget.dragging = true; + + event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); + + var pointStart = this.position; + var pointEnd = this.workingArea.backgroundImage.toLocal(this.toGlobal(this.upLeft.position)); + + const delX = pointEnd.x - pointStart.x; + const delY = pointEnd.y - pointStart.y; + + this.pivot.set(this.upLeft.x, this.upLeft.y); + + this.position.x += delX; + this.position.y += delY; + + this.assetData.PivotX = this.pivot.x; + this.assetData.PivotY = this.pivot.y; + this.assetData.Point = new Point(this.x, this.y); + }) + .on('pointerup', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointerupoutside', event => { + if (event.currentTarget.dragging) { + event.currentTarget.alpha = 1; + event.currentTarget.dragging = false; + event.currentTarget.data = null; + } + }) + .on('pointermove', event => { + if (event.currentTarget.dragging) { + const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); + var startPos = this.position; + var endPos = this.workingArea.backgroundImage.toLocal(this.toGlobal(newPosition)); + var width = (endPos.x - startPos.x); + var height = (endPos.y - startPos.y); + var scaleX = width / (this.width / this.scale.x); + var scaleY = height / (this.width / this.scale.x); + var angle = Math.abs(this.angle); + console.log(angle); + if (angle === 0) { + this.scale.set(scaleX); + } else if (angle === 90) { + this.scale.set(-scaleY); + } else if (angle === 180) { + this.scale.set(-scaleX); + } else if (angle === 270) { + this.scale.set(scaleY); + } + this.assetData.Scale = this.scale.x; + } + }) + .on('rightclick', event => { + this.border.visible = false; + }); + } + /** + * 璁剧疆鐐规樉绀虹姸鎬 + * @param value 鏄剧ず鐘舵 + */ + public setPointVisiable(value: boolean) { + let rect = this.getLocalBounds(); + this.upLeft.x = rect.left; + this.upLeft.y = rect.top; + this.upRight.x = rect.right; + this.upRight.y = rect.top; + this.downLeft.x = rect.left; + this.downLeft.y = rect.bottom; + this.downRight.x = rect.right; + this.downRight.y = rect.bottom; + this.upLeft.visible = value; + this.upRight.visible = value; + this.downLeft.visible = value; + this.downRight.visible = value; + } + /** + * + * @param scale 缁樺埗杈规 + */ + public drawBorder(scale: number) { + let visible = this.upLeft.visible; + console.log(visible); + this.setPointVisiable(false); + + super.drawBorder(scale); + let rect = this.getLocalBounds(); + this.upLeft.x = rect.left; + this.upLeft.y = rect.top; + this.upRight.x = rect.right; + this.upRight.y = rect.top; + this.downLeft.x = rect.left; + this.downLeft.y = rect.bottom; + this.downRight.x = rect.right; + this.downRight.y = rect.bottom; + this.setPointVisiable(visible); } } diff --git a/src/app/working-area/model/axRectangleShape.ts b/src/app/working-area/model/axRectangleShape.ts index d4e7b2c..297ffdb 100644 --- a/src/app/working-area/model/axRectangleShape.ts +++ b/src/app/working-area/model/axRectangleShape.ts @@ -1,39 +1,20 @@ -/** - * Copyright (c) 2006-2015, JGraph Ltd - * Copyright (c) 2006-2015, Gaudenz Alder - */ +import { Sprite } from "pixi.js"; import { Graphics } from "pixi.js"; -/** - * Class: mxRectangleShape - * - * Extends to implement a rectangle shape. - * This shape is registered under - * in . - * - * Constructor: mxRectangleShape - * - * Constructs a new rectangle shape. - * - * Parameters: - * - * bounds - that defines the bounds. This is stored in - * . - * fill - String that defines the fill color. This is stored in . - * stroke - String that defines the stroke color. This is stored in . - * strokewidth - Optional integer that defines the stroke width. Default is - * 1. This is stored in . - */ -export class AxRectangleShape extends Graphics{ +import { WorkingAreaComponent } from "../working-area.component"; +import { AxShape } from "./axShape"; + +export class AxRectangleShape extends AxShape{ /** * */ - constructor(x:number,y:number,width:number,height:number) { - super(); - this.beginFill(0x0000ff,0); - this.lineStyle(1, 0xff0000,0); + constructor(x:number,y:number,width:number,height:number,assetData: any, workingArea: WorkingAreaComponent) { + super(assetData,workingArea); + this.beginFill(0x0000ff,1); + this.lineStyle(1, 0xff0000,1); this.drawRect(x, y, width, height); this.endFill(); - console.log(this.getLocalBounds()); + + } diff --git a/src/app/working-area/model/axShape.ts b/src/app/working-area/model/axShape.ts index 7e784b3..27c1773 100644 --- a/src/app/working-area/model/axShape.ts +++ b/src/app/working-area/model/axShape.ts @@ -6,7 +6,7 @@ import { WorkingAreaComponent } from '../working-area.component'; /** * 瀹変俊褰㈢姸 */ -export class AxShape extends Container { +export class AxShape extends Graphics { assetData: any; pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png') workingArea: WorkingAreaComponent; @@ -83,12 +83,6 @@ export class AxShape extends Container { }) .on('rightclick', event => { this.border.visible = false; - }) - .on('pointerover', event => { - event.stopPropagation(); - }) - .on('pointerout', event => { - event.stopPropagation(); }); } redraw(): void { @@ -101,23 +95,14 @@ export class AxShape extends Container { public setItemScale(scale: number) { } - /** - * 鏄剧ず杈规 - */ + public showBorder() { - if (this.assetData.FixedSize) { - this.drawBorder(1); - } - else { - this.drawBorder(1/this.workingArea.backgroundImage.scale.x); - } this.border.visible = true; } /** * 闅愯棌杈规 */ public hideBorder() { - this.border.clear(); this.border.visible = false; } /** @@ -151,13 +136,13 @@ export class AxShape extends Container { this.drawDash(this.border, p4.x, p4.y + 0.5*scale, p1.x, p1.y - 0.5*scale, dashLength, spaceLength); this.border.lineStyle(0, 0x0000ff); - this.border.beginFill(0x00ff00,0.1); + // this.border.beginFill(0x00ff00,0.1); this.border.moveTo(p1.x, p1.y); this.border.lineTo(p2.x, p2.y); this.border.lineTo(p3.x, p4.y); this.border.lineTo(p4.x, p4.y); this.border.closePath(); - this.border.endFill(); + // this.border.endFill(); } // 鐢昏櫄绾 drawDash(target, x1, y1, x2, y2,dashLength = 5, spaceLength = 1) { diff --git a/src/app/working-area/model/messageSystem.ts b/src/app/working-area/model/messageSystem.ts new file mode 100644 index 0000000..322eef4 --- /dev/null +++ b/src/app/working-area/model/messageSystem.ts @@ -0,0 +1,37 @@ +class MyEvent extends CustomEvent { + public static readonly CMD: string = "EVENT_NAME"; + public constructor($type: string , $data: T ) { + super( $type , { detail: $data, bubbles: true, cancelable: true, composed: true }); + } +} + +class MyDispatch extends EventTarget { + private static _instance: MyDispatch; + public static get Instance(): MyDispatch { + if (!MyDispatch._instance) MyDispatch._instance = new MyDispatch(); + return MyDispatch._instance; + } + public send($data: T, $type: string = MyEvent.CMD): void { + const $event: CustomEvent = new MyEvent($type, $data); + this.dispatchEvent($event); + } +} + +class Test { + + public constructor() { + MyDispatch.Instance.addEventListener(MyEvent.CMD, this.onEvent as EventListener); + } + private onEvent($e: MyEvent): void { + console.log(`target ${$e.target}`); + console.log(`name: ${$e.detail._name} , occupation: ${$e.detail._occupation}`); + } +} + +interface ITest { + _name: string; + _occupation: string; +} + +let $test: Test = new Test(); +MyDispatch.Instance.send({ _name: `Aonaufly`, _occupation: `it` }); diff --git a/src/app/working-area/model/multipointIcon.ts b/src/app/working-area/model/multipointIcon.ts index a996b5f..55ac71a 100644 --- a/src/app/working-area/model/multipointIcon.ts +++ b/src/app/working-area/model/multipointIcon.ts @@ -189,6 +189,16 @@ export class MultipointIcon extends AxShape { item.visible = value; }); } + /** + * + * @param scale 缁樺埗杈规 + */ + public drawBorder(scale: number) { + let visible = this.pointsGraphics[0].visible; + this.setPointVisiable(false); + super.drawBorder(scale); + this.setPointVisiable(visible); + } // 璁剧疆鍚嶇О public setNameVisible(value: boolean, mode: GameMode) { if (this.assetData.GameMode === mode) { diff --git a/src/app/working-area/model/polygonIcon.ts b/src/app/working-area/model/polygonIcon.ts index 2494748..0186a11 100644 --- a/src/app/working-area/model/polygonIcon.ts +++ b/src/app/working-area/model/polygonIcon.ts @@ -155,6 +155,16 @@ export class PolygonIcon extends AxShape { item.visible = value; }); } + /** + * + * @param scale 缁樺埗杈规 + */ + public drawBorder(scale: number) { + let visible = this.pointsGraphics[0].visible; + this.setPointVisiable(false); + super.drawBorder(scale); + this.setPointVisiable(visible); + } // 璁剧疆缂╂斁 public setItemScale(scale: number) { // this.text.scale.set(scale); diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 37f9aba..7b8f07e 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -108,6 +108,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 纭缁樺埗鎸夐挳 */ private enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.png'); + + /** + * 缂栬緫鐐瑰浘鐗 + */ + editorPointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png') /** * 妗嗛夊伐鍏峰浘褰 */ @@ -142,7 +147,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // Beta鐗: 璇ョ増鏈浉瀵逛簬伪鐗堝凡鏈変簡寰堝ぇ鐨勬敼杩涳紝娑堥櫎浜嗕弗閲嶇殑閿欒锛屼絾杩樻槸瀛樺湪鐫涓浜涚己闄凤紝闇瑕佺粡杩囧娆℃祴璇曟潵杩涗竴姝ユ秷闄わ紝姝ょ増鏈富瑕佺殑淇敼瀵瑰儚鏄蒋浠剁殑UI銆 // RC鐗: 璇ョ増鏈凡缁忕浉褰撴垚鐔熶簡锛屽熀鏈笂涓嶅瓨鍦ㄥ鑷撮敊璇殑BUG锛屼笌鍗冲皢鍙戣鐨勬寮忕増鐩稿樊鏃犲嚑銆 // Release鐗: 璇ョ増鏈剰鍛斥滄渶缁堢増鏈濓紝鍦ㄥ墠闈㈢増鏈殑涓绯诲垪娴嬭瘯鐗堜箣鍚庯紝缁堝綊浼氭湁涓涓寮忕増鏈紝鏄渶缁堜氦浠樼敤鎴蜂娇鐢ㄧ殑涓涓増鏈傝鐗堟湰鏈夋椂涔熺О涓烘爣鍑嗙増銆備竴鑸儏鍐典笅锛孯elease涓嶄細浠ュ崟璇嶅舰寮忓嚭鐜板湪杞欢灏侀潰涓婏紝鍙栬屼唬涔嬬殑鏄鍙仿 - public VERSION = '1.0.5.20210111_beta'; + public VERSION = '1.0.6.20210112_beta'; /** * 鏁版嵁鍒濆鍖 */ @@ -340,9 +345,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 閫変腑浜嬩欢 */ - this.on('select', (axShape:AxShape)=> { - axShape.showBorder(); - axShape.setPointVisiable(this.allowEdit); + this.on('select', (axShape: AxShape) => { + // if (axShape instanceof AxRectangleShape) { + // let upLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture); + // let upRight: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture); + // let downLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture); + // let downRight: PIXI.Sprite = new PIXI.Sprite(this.editorPointTexture); + // } else { + axShape.showBorder(); + axShape.drawBorder(1/this.backgroundImage.scale.x); + axShape.setPointVisiable(this.allowEdit); + // } }); /** * 鍙栨秷閫変腑浜嬩欢 @@ -359,6 +372,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (axShape.assetData.GameMode === GameMode.BasicInformation) { // 鍩烘湰淇℃伅 // 娣诲姞妤煎眰鏁版嵁 this.canvasData.originaleveryStoreyData.data[axShape.assetData.Id] = axShape.assetData; + console.log(this.canvasData.originaleveryStoreyData); // 娣诲姞寤虹瓚鏁版嵁 this.canvasData.originalcompanyBuildingData.data[axShape.assetData.Id] = axShape.assetData; } else if (axShape.assetData.GameMode === GameMode.Assignment) { // 澶勭疆棰勬 @@ -381,7 +395,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // } var temp = this.backgroundImage.getChildByName("鍥句緥") as AxLegend; if ( temp !== undefined - && temp !== null) { + && temp !== null + && axShape.assetData.Name !== "鍥句緥") { var itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); temp.addItem(itemLegend); } @@ -395,7 +410,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // 鍒犻櫎鍥句緥瀵硅薄 var temp = this.backgroundImage.getChildByName("鍥句緥") as AxLegend; if ( temp !== undefined - && temp !== null) { + && temp !== null + && axShape.assetData.Name !== "鍥句緥") { var itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); temp.deleteItem(itemLegend); } @@ -603,6 +619,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.backgroundImage .on('pointerdown', event => { if (event.data.button !== 0) return; + console.log(this.backgroundImage.toLocal(this.mousePosition)); if (!event.currentTarget.dragging && this.selection.isMultiselection === false) { this.selection.deselectAll(); event.currentTarget.data = event.data; @@ -942,19 +959,56 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.createFloorShape(this.canvasData.originaleveryStoreyData.data); // 鍒涘缓澶勭疆棰勬鍥惧舰 this.createNodeShape(this.canvasData.selectPanelPoint.Data); - // this.createAxLegend(); + this.createAxLegend(); // // 娴嬭瘯浠g爜 - // var rectShape = new AxRectangleShape(0, 0, 100, 100); - // this.backgroundImage.addChild(rectShape); + // const tempAssetData = { + // Id: "鍥句緥",//ObjectID.default.generate() + // Color: "#066EED80", + // PropertyInfos: [ + // { + // Tag : '', + // Order : 0, + // Enabled : true, + // Visible : true, + // Required : false, + // RuleName : "", + // RuleValue : "", + // PhysicalUnit : "", + // PropertyName : "鍒", + // PropertyType : 2, + // PropertyValue : 2, + // }, + // ] + // }; + // var rectShape = new AxRectangleShape(0, 0, 100, 100,tempAssetData,this); } /** * 鍒涘缓瀹変俊鍥句緥 */ public createAxLegend() { const tempAssetData = { - Id: "鍥句緥",//ObjectID.default.generate() + Id: "鍥句緥", + Name:"鍥句緥", Color: "#066EED80", + TemplateId: null, + FloorId: this.canvasData.selectStorey.id, + Angle: 0, + Enabled: null, + FillMode: null, + FireElementId: null, + FixedSize: null, + Height: 32, + Width: 32, + ImageUrl: null, + InteractiveMode: null, + MultiPoint: null, + Point: new PIXI.Point(0, 0), + Border: null, + DrawMode: null, + Thickness: null, + IsFromBuilding: null, + GameMode: this.canvasData.gameMode, PropertyInfos: [ { Tag : '', @@ -969,26 +1023,39 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV PropertyType : 2, PropertyValue : 2, }, - ] + ], + Scale: 1, + PivotX: 0, + PivotY: 0, }; let shapeMap: Map = new Map(); - + let data = null; for (let item in this.canvasData.originaleveryStoreyData.data) { if (shapeMap.has(this.canvasData.originaleveryStoreyData.data[item].Name)) { shapeMap.get(this.canvasData.originaleveryStoreyData.data[item].Name).Count++; } else { - shapeMap.set(this.canvasData.originaleveryStoreyData.data[item].Name, new Legend( + if (item !== "鍥句緥") { + shapeMap.set(this.canvasData.originaleveryStoreyData.data[item].Name, new Legend( this.canvasData.originaleveryStoreyData.data[item].Name, this.canvasData.originaleveryStoreyData.data[item].ImageUrl, 1 )); + } else { + data = this.canvasData.originaleveryStoreyData.data[item]; + } } } - var axLegend = new AxLegend(tempAssetData, this, shapeMap); - var rect = this.backgroundImage.getLocalBounds(); - var itemRect = axLegend.getLocalBounds(); - axLegend.x = rect.right - itemRect.right; - axLegend.y = rect.bottom - itemRect.bottom; + if (data === null) { + var axLegend = new AxLegend(tempAssetData, this, shapeMap); + var rect = this.backgroundImage.getLocalBounds(); + var itemRect = axLegend.getLocalBounds(); + axLegend.x = rect.right - itemRect.right; + axLegend.y = rect.bottom - itemRect.bottom; + axLegend.assetData.Point = new PIXI.Point(axLegend.x, axLegend.y); + this.emit('createIcon', axLegend); + } else { + var axLegend = new AxLegend(data, this, shapeMap); + } } // /** // * 娓呯┖鐢诲竷