|
|
|
@ -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'; |
|
|
|
@ -25,6 +27,10 @@ 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.refresh(); |
|
|
|
|
} |
|
|
|
@ -109,7 +115,6 @@ export class AxLegend extends AxShape {
|
|
|
|
|
this.pen.endFill(); |
|
|
|
|
}
|
|
|
|
|
this.addChild(this.pen); |
|
|
|
|
this.angle = -this.workingArea.backgroundImage.angle; |
|
|
|
|
// 添加border
|
|
|
|
|
this.addChild(this.border); |
|
|
|
|
// 添加控制点
|
|
|
|
@ -117,8 +122,6 @@ export class AxLegend extends AxShape {
|
|
|
|
|
this.upLeft.anchor.set(0.5); |
|
|
|
|
this.upLeft.interactive = true; |
|
|
|
|
this.upLeft.visible = false; |
|
|
|
|
var posX = 0; |
|
|
|
|
var w = this.width; |
|
|
|
|
this.upLeft |
|
|
|
|
.on('pointerdown', event => { |
|
|
|
|
event.stopPropagation(); |
|
|
|
@ -128,11 +131,20 @@ export class AxLegend extends AxShape {
|
|
|
|
|
|
|
|
|
|
event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); |
|
|
|
|
|
|
|
|
|
var gPos = this.upLeft.getGlobalPosition(new Point(this.downRight.x, this.downRight.y)); |
|
|
|
|
var temp1 = this.workingArea.backgroundImage.toLocal(gPos); |
|
|
|
|
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.set(temp1.x,temp1.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) { |
|
|
|
@ -151,40 +163,234 @@ export class AxLegend extends AxShape {
|
|
|
|
|
.on('pointermove', event => { |
|
|
|
|
if (event.currentTarget.dragging) { |
|
|
|
|
const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); |
|
|
|
|
// event.currentTarget.x = newPosition.x;
|
|
|
|
|
// event.currentTarget.y = newPosition.y;
|
|
|
|
|
var width = -(newPosition.x - event.currentTarget.dragPoint.x) |
|
|
|
|
var height = -(newPosition.y - event.currentTarget.dragPoint.y); |
|
|
|
|
if (width > 0) { |
|
|
|
|
this.scale.x += 0.01; |
|
|
|
|
this.scale.y += 0.01; |
|
|
|
|
} else { |
|
|
|
|
this.scale.x -= 0.01; |
|
|
|
|
this.scale.y -= 0.01; |
|
|
|
|
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; |
|
|
|
|
}) |
|
|
|
|
.on('pointerover', event => { |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
}) |
|
|
|
|
.on('pointerout', event => { |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
}); |
|
|
|
|
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; |
|
|
|
|
}); |
|
|
|
|
this.angle = -this.workingArea.backgroundImage.angle; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置点显示状态 |
|
|
|
|