Browse Source

图形上点击时,如果右侧面板没有打开不再进行重绘图形

niuheng 2 years ago
parent
commit
ad0ab198e3
2 changed files with 16 additions and 2 deletions
  1. 8 2
      src/components/systemGraph/edit.vue
  2. 8 0
      src/components/systemGraph/graph.vue

+ 8 - 2
src/components/systemGraph/edit.vue

@@ -311,14 +311,19 @@
               src="@/assets/images/systemGraph/fontNotWeight.svg"
               class="fontStyleSvg"
               title="点击加粗"
-              v-if="operState == 1&&(selText.style || {}).fontWeight == notFotWeight"
+              v-if="
+                operState == 1 &&
+                (selText.style || {}).fontWeight == notFotWeight
+              "
               @click="fontWeightChange(1)"
             />
             <img
               src="@/assets/images/systemGraph/fontStyle.svg"
               class="fontStyleSvg"
               title="点击取消加粗"
-              v-if="operState == 1&&(selText.style || {}).fontWeight == fontWeight"
+              v-if="
+                operState == 1 && (selText.style || {}).fontWeight == fontWeight
+              "
               @click="fontWeightChange(0)"
             />
             <span v-if="operState == 0" v-text="selFontSize.name"></span>
@@ -773,6 +778,7 @@ export default {
     //关闭右侧详情框
     closeRight: function () {
       var _this = this;
+      if (_this.selGraphPartType == -1) return;
       this.selGraphPartType = -1;
       Vue.nextTick(function () {
         _this.$refs.graphc.resetDraw();

+ 8 - 0
src/components/systemGraph/graph.vue

@@ -292,6 +292,11 @@ export default {
           lineInstance.lineTo(_newTo.x, _newTo.y);
         }
 
+        /**
+         * 对于矩形、线等图形,在设置鼠标事件时,需要设置事件的响应范围;
+         * 但是对于线,暂时没有找到合适的设置其响应范围的方式,所以暂时取消其点击事件,
+         *  改为点击时冒泡到canvas上的方式,判断点击的点是否在线的实例的点的范围内来判断是否是线的点击
+         * */
         //设置点击范围,不然click事件不会触发
         lineInstance.hitArea = lineInstance.getBounds();
         //启用事件
@@ -819,6 +824,9 @@ export default {
 
   mounted() {},
   components: {},
+  beforeDestroy: function () {
+    this.pixiApp.destroy(true);
+  },
 };
 </script>