|
@@ -15,8 +15,8 @@
|
|
|
:suffix="item.unit"
|
|
|
/>
|
|
|
</li>
|
|
|
- <li>
|
|
|
- <img class="lock" :src="require(`./../../assets/images/t-lock.png`)" alt />
|
|
|
+ <li @click="lockItem" :title="isLock?'锁定':'解锁'">
|
|
|
+ <Icon style="vertical-align: middle;" :name="isLock?'lock':'unlock'" />
|
|
|
</li>
|
|
|
</ul>
|
|
|
<attrSelect v-show="attrType" :type="attrType" :focusItemList="focusItemList" />
|
|
@@ -97,6 +97,8 @@ export default {
|
|
|
attrType: "",
|
|
|
elementData: [],
|
|
|
key: "",
|
|
|
+ isLock: false,
|
|
|
+ aspectRatio: 1,// 元素宽高比
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -123,11 +125,40 @@ export default {
|
|
|
onSearch(key) {
|
|
|
console.log(key);
|
|
|
},
|
|
|
+ // 切换锁状态
|
|
|
+ lockItem() {
|
|
|
+ this.isLock = !this.isLock;
|
|
|
+ if (this.isLock) {
|
|
|
+ let width,height;
|
|
|
+ this.msgList.forEach(item => {
|
|
|
+ if (item.name == "Width") {
|
|
|
+ width = item.msg;
|
|
|
+ } else if (item.name == "Height") {
|
|
|
+ height = item.msg;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.aspectRatio = width / height;
|
|
|
+ }
|
|
|
+ },
|
|
|
// 改变状态
|
|
|
changeStatus(item) {
|
|
|
if (item.name == "Width") {
|
|
|
+ if (this.isLock) {
|
|
|
+ const height = item.msg / this.aspectRatio;
|
|
|
+ this.msgList.find(item => {
|
|
|
+ return item.name == "Height"
|
|
|
+ }).msg = height;
|
|
|
+ bus.$emit("itemHeight", height);
|
|
|
+ }
|
|
|
bus.$emit("itemWidth", item.msg);
|
|
|
} else if (item.name == "Height") {
|
|
|
+ if (this.isLock) {
|
|
|
+ const width = item.msg * this.aspectRatio;
|
|
|
+ this.msgList.find(item => {
|
|
|
+ return item.name == "Width"
|
|
|
+ }).msg = width;
|
|
|
+ bus.$emit("itemWidth", width);
|
|
|
+ }
|
|
|
bus.$emit("itemHeight", item.msg);
|
|
|
} else if (item.name == "X" || item.name == "Y") {
|
|
|
let x,
|
|
@@ -161,9 +192,13 @@ export default {
|
|
|
item.msg = 0;
|
|
|
}
|
|
|
});
|
|
|
+ this.aspectRatio = 1;
|
|
|
} else {
|
|
|
this.msgList.forEach(item => {
|
|
|
const Item = newVal.itemList[0];
|
|
|
+ const width = Item.boundingRect().width;
|
|
|
+ const height = Item.boundingRect().height;
|
|
|
+ this.aspectRatio = width / height;
|
|
|
if (item.name == "X") {
|
|
|
item.msg = Item.mapToScene(
|
|
|
Item.boundingRect().left,
|
|
@@ -177,9 +212,9 @@ export default {
|
|
|
).y;
|
|
|
}
|
|
|
if (item.name == "Width") {
|
|
|
- item.msg = Item.boundingRect().width;
|
|
|
- // 针对icon 以及图片
|
|
|
- if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
|
|
|
+ item.msg = width;
|
|
|
+ // 针对图片
|
|
|
+ if (Item instanceof SImageMarkerItem) {
|
|
|
item.disable = false;
|
|
|
// item.msg = Item.width;
|
|
|
} else {
|
|
@@ -187,8 +222,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
if (item.name == "Height") {
|
|
|
- item.msg = Item.boundingRect().height;
|
|
|
- if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
|
|
|
+ item.msg = height;
|
|
|
+ if (Item instanceof SImageMarkerItem) {
|
|
|
item.disable = false;
|
|
|
// item.msg = Item.height;
|
|
|
} else {
|