在某图片进行缩放和旋转操作之后,若想找到顶点坐标可如下:
private UpdatabecomebuttonUI() {
//更新选中图片轮廓
this.ShapeGroup.removeChildren();
var shape: egret.Shape = new egret.Shape();
shape.graphics.lineStyle(2, 0xff00ff);
this.NowchooseDecoration.y, 10);
//左上 左下 右上 右下
let leftup = new egret.Point(0, 0);
let leftdown = new egret.Point(0, 0);;
let rightup = new egret.Point(0, 0);;
let rightdown = new egret.Point(0, 0);;
let tanB = this.NowchooseDecoration.width / this.NowchooseDecoration.height;
let B = Math.atan(tanB) / (Math.PI / 180);
let numangle = this.NowchooseDecoration.rotation + B;
let numangle2 = this.NowchooseDecoration.rotation - B;
let xiebian = Math.sqrt(Math.pow(this.NowchooseDecoration.height / 2, 2) + Math.pow(this.NowchooseDecoration.width / 2, 2)) * this.NowchooseDecoration.scaleY;
let x = 0;
let y = 0;
if (numangle > 360) {
numangle -= 360;
}
leftup.x = this.NowchooseDecoration.x + xiebian * Math.cos((90 - numangle2) * Math.PI / 180);
leftup.y = this.NowchooseDecoration.y - xiebian * Math.sin((90 - numangle2) * Math.PI / 180);
leftdown.x = this.NowchooseDecoration.x - xiebian * Math.cos((90 - numangle) * Math.PI / 180);
leftdown.y = this.NowchooseDecoration.y + xiebian * Math.sin((90 - numangle) * Math.PI / 180);
rightup.x = this.NowchooseDecoration.x + xiebian * Math.cos((90 - numangle) * Math.PI / 180);
rightup.y = this.NowchooseDecoration.y - xiebian * Math.sin((90 - numangle) * Math.PI / 180);
rightdown.x = this.NowchooseDecoration.x - xiebian * Math.cos((90 - numangle2) * Math.PI / 180);
rightdown.y = this.NowchooseDecoration.y + xiebian * Math.sin((90 - numangle2) * Math.PI / 180);
this.NowchooseDecoration.anchorOffsetX + 201, this.NowchooseDecoration.y + this.NowchooseDecoration.anchorOffsetY + 201, 10);
shape.graphics.moveTo(leftup.x, leftup.y);
shape.graphics.lineTo(rightup.x, rightup.y);
shape.graphics.lineTo(rightdown.x, rightdown.y);
shape.graphics.lineTo(leftdown.x, leftdown.y);
shape.graphics.lineTo(leftup.x, leftup.y);
this.ShapeGroup.addChild(shape);
}