|
@@ -142,12 +142,12 @@ export class SIconTextItem extends SObjectItem {
|
|
|
this.img.url = `http://adm.sagacloud.cn:8080/doc/assets/img/logo.png`;
|
|
|
this.img.width = 24;
|
|
|
this.img.height = 24;
|
|
|
- this.img.connect("onMove", this, this.moveAhchorPoint.bind(this));
|
|
|
+ this.img.connect("onMove", this, this.changeAhchorPoint.bind(this));
|
|
|
let anchorPoint = [
|
|
|
- { x: this.img.x, y: this.img.height / 2 },
|
|
|
- { x: this.img.x, y: -this.img.height / 2 },
|
|
|
- { x: -this.img.width / 2, y: this.img.y },
|
|
|
- { x: this.img.width / 2, y: this.img.y }
|
|
|
+ { x: this.img.x, y: this.img.y + (this.img.height / 2) },
|
|
|
+ { x: this.img.x, y: this.img.y - (this.img.height / 2) },
|
|
|
+ { x: this.img.x - (this.img.width / 2), y: this.img.y },
|
|
|
+ { x: this.img.x + (this.img.width / 2), y: this.img.y }
|
|
|
];
|
|
|
this.anchorList = anchorPoint.map(t => {
|
|
|
let item = new SAnchorItem(this);
|
|
@@ -166,30 +166,17 @@ export class SIconTextItem extends SObjectItem {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 图片移动计算并移动锚点的位置
|
|
|
- *
|
|
|
- * */
|
|
|
- private moveAhchorPoint(): void {
|
|
|
- // 判断是否有锚点
|
|
|
- if (this.anchorList.length) {
|
|
|
- this.anchorList.forEach(item => {
|
|
|
- item.moveTo(item.x + this.img.x, item.y + this.img.y);
|
|
|
- })
|
|
|
- }
|
|
|
- } // Function moveAhchorPoint()
|
|
|
-
|
|
|
- /**
|
|
|
- * 图片大小改变计算并移动锚点的位置
|
|
|
+ * 计算并移动锚点的位置
|
|
|
*
|
|
|
* */
|
|
|
private changeAhchorPoint(): void {
|
|
|
// 判断是否有锚点
|
|
|
if (this.anchorList.length) {
|
|
|
let anchorPoint = [
|
|
|
- { x: this.img.x, y: this.img.height / 2 },
|
|
|
- { x: this.img.x, y: -this.img.height / 2 },
|
|
|
- { x: -this.img.width / 2, y: this.img.y },
|
|
|
- { x: this.img.width / 2, y: this.img.y }
|
|
|
+ { x: this.img.x, y: this.img.y + (this.img.height / 2) },
|
|
|
+ { x: this.img.x, y: this.img.y - (this.img.height / 2) },
|
|
|
+ { x: this.img.x - (this.img.width / 2), y: this.img.y },
|
|
|
+ { x: this.img.x + (this.img.width / 2), y: this.img.y }
|
|
|
];
|
|
|
this.anchorList.forEach((item, index) => {
|
|
|
item.moveTo(anchorPoint[index].x, anchorPoint[index].y);
|