|
@@ -24,10 +24,24 @@
|
|
|
</a-tab-pane>
|
|
|
<a-tab-pane key="2" tab="元素" force-render>
|
|
|
<div class="element">
|
|
|
- <a-input-search placeholder="搜索" style="margin-bottom: 12px;" v-model="key" @search="onSearch" />
|
|
|
+ <a-input-search
|
|
|
+ placeholder="搜索"
|
|
|
+ style="margin-bottom: 12px;"
|
|
|
+ v-model="key"
|
|
|
+ @search="onSearch"
|
|
|
+ />
|
|
|
<ul class="element-list">
|
|
|
- <li v-for="ele in elementData" :key="ele.id" @click="clickElement(ele)" v-show="key?ele.name.search(key) != -1:true">
|
|
|
- <el-image style="width: 45px; height: 26px; margin-top: 6px;" :src="ele.data.Properties.IconUrl" fit="contain"></el-image>
|
|
|
+ <li
|
|
|
+ v-for="ele in elementData"
|
|
|
+ :key="ele.id"
|
|
|
+ @click="clickElement(ele)"
|
|
|
+ v-show="key?ele.name.search(key) != -1:true"
|
|
|
+ >
|
|
|
+ <el-image
|
|
|
+ style="width: 45px; height: 26px; margin-top: 6px;"
|
|
|
+ :src="ele.data.Properties.IconUrl"
|
|
|
+ fit="contain"
|
|
|
+ ></el-image>
|
|
|
<span class="element-name">{{ele.name}}</span>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -99,13 +113,13 @@ export default {
|
|
|
elementData: [],
|
|
|
key: "",
|
|
|
isLock: true,
|
|
|
- aspectRatio: 1,// 元素宽高比
|
|
|
+ aspectRatio: 1 // 元素宽高比
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取元素数据
|
|
|
listenElementData() {
|
|
|
- bus2.$off('elementDataChange')
|
|
|
+ bus2.$off("elementDataChange");
|
|
|
bus2.$on("elementDataChange", val => {
|
|
|
this.elementData = [];
|
|
|
if (val.Nodes.length) {
|
|
@@ -131,7 +145,7 @@ export default {
|
|
|
lockItem() {
|
|
|
this.isLock = !this.isLock;
|
|
|
if (this.isLock) {
|
|
|
- let width,height;
|
|
|
+ let width, height;
|
|
|
this.msgList.forEach(item => {
|
|
|
if (item.name == "Width") {
|
|
|
width = item.msg;
|
|
@@ -148,7 +162,7 @@ export default {
|
|
|
if (this.isLock) {
|
|
|
const height = item.msg / this.aspectRatio;
|
|
|
this.msgList.find(item => {
|
|
|
- return item.name == "Height"
|
|
|
+ return item.name == "Height";
|
|
|
}).msg = height;
|
|
|
bus.$emit("itemHeight", height);
|
|
|
}
|
|
@@ -157,7 +171,7 @@ export default {
|
|
|
if (this.isLock) {
|
|
|
const width = item.msg * this.aspectRatio;
|
|
|
this.msgList.find(item => {
|
|
|
- return item.name == "Width"
|
|
|
+ return item.name == "Width";
|
|
|
}).msg = width;
|
|
|
bus.$emit("itemWidth", width);
|
|
|
}
|
|
@@ -173,21 +187,21 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
bus.$emit("itemPositon", x, y);
|
|
|
- } else if (item.name == 'Angle') {
|
|
|
+ } else if (item.name == "Angle") {
|
|
|
if (item.msg.length > 0 && !isNaN(Number(item.msg))) {
|
|
|
if (item.msg > 360) {
|
|
|
- item.msg = 360
|
|
|
+ item.msg = 360;
|
|
|
}
|
|
|
if (item.msg < -360) {
|
|
|
- item.msg = -360
|
|
|
+ item.msg = -360;
|
|
|
}
|
|
|
- bus.$emit('itemAngle', item.msg)
|
|
|
+ bus.$emit("itemAngle", item.msg);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 点击选中元素
|
|
|
- clickElement(ele){
|
|
|
- bus.$emit('toggleItem',ele)
|
|
|
+ clickElement(ele) {
|
|
|
+ bus.$emit("toggleItem", ele);
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -207,14 +221,14 @@ export default {
|
|
|
if (item.name == "Height") {
|
|
|
item.msg = 0;
|
|
|
}
|
|
|
- if (item.name == 'Angle') {
|
|
|
- item.msg = '0'
|
|
|
+ if (item.name == "Angle") {
|
|
|
+ item.msg = "0";
|
|
|
}
|
|
|
});
|
|
|
this.aspectRatio = 1;
|
|
|
} else {
|
|
|
// 属性输入框宽高显示的数值
|
|
|
- let inputW,inputH;
|
|
|
+ let inputW, inputH;
|
|
|
this.msgList.forEach(item => {
|
|
|
const Item = newVal.itemList[0];
|
|
|
const width = Item.boundingRect().width;
|
|
@@ -238,7 +252,9 @@ export default {
|
|
|
item.msg = Item.img.width;
|
|
|
}
|
|
|
// 针对图片及Icon
|
|
|
- if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
|
|
|
+ if (
|
|
|
+ Item instanceof SImageMarkerItem
|
|
|
+ ) {
|
|
|
item.disable = false;
|
|
|
} else {
|
|
|
item.disable = true;
|
|
@@ -252,7 +268,9 @@ export default {
|
|
|
item.msg = Item.img.height;
|
|
|
}
|
|
|
// 针对图片及Icon
|
|
|
- if (Item instanceof SImageMarkerItem || Item instanceof SImageLegendItem) {
|
|
|
+ if (
|
|
|
+ Item instanceof SImageMarkerItem
|
|
|
+ ) {
|
|
|
item.disable = false;
|
|
|
} else {
|
|
|
item.disable = true;
|
|
@@ -261,11 +279,12 @@ export default {
|
|
|
}
|
|
|
if (item.name == "Angle") {
|
|
|
if (Item instanceof SImageLegendItem) {
|
|
|
- item.disable = false
|
|
|
+ item.disable = false;
|
|
|
+ item.msg = Item.img.rotate;
|
|
|
} else {
|
|
|
- item.disable = true
|
|
|
+ item.disable = true;
|
|
|
+ item.msg = 0;
|
|
|
}
|
|
|
- item.msg = Item.img.rotate
|
|
|
}
|
|
|
});
|
|
|
this.aspectRatio = inputW / inputH;
|