ソースを参照

feat:dash&lineWidth

ananzhusen 10 ヶ月 前
コミット
9126f6dd52
2 ファイル変更24 行追加3 行削除
  1. 11 0
      src/views/components/PenProps.vue
  2. 13 3
      src/views/components/pen.ts

+ 11 - 0
src/views/components/PenProps.vue

@@ -296,7 +296,9 @@
                     style="width: 80px"
                   >
                     <template #valueDisplay="{ value }">
+                      <div v-if="value === -1">无</div>
                       <svg
+                        v-else
                         xmlns="http://www.w3.org/2000/svg"
                         version="1.1"
                         style="width: 100%; height: 20px"
@@ -321,6 +323,15 @@
                         </g>
                       </svg>
                     </template>
+                    <t-option :key="-1" :value="-1">
+                      <div class="flex" style=" align-items:center;">
+                        <svg  class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="12">
+                          <path d="M113.777778 0h796.444444a113.777778 113.777778 0 0 1 113.777778 113.777778v796.444444a113.777778 113.777778 0 0 1-113.777778 113.777778H113.777778a113.777778 113.777778 0 0 1-113.777778-113.777778V113.777778a113.777778 113.777778 0 0 1 113.777778-113.777778z m0 85.333333a28.444444 28.444444 0 0 0-28.444445 28.444445v796.444444a28.444444 28.444444 0 0 0 28.444445 28.444445h796.444444a28.444444 28.444444 0 0 0 28.444445-28.444445V113.777778a28.444444 28.444444 0 0 0-28.444445-28.444445H113.777778z" fill="#e3e8f4" p-id="37532"></path>
+                          <path d="M897.706667 75.662222L105.813333 894.748444a42.666667 42.666667 0 0 0 61.326223 59.278223l791.893333-819.143111a42.666667 42.666667 0 1 0-61.383111-59.335112z" fill="#ff4000" p-id="37533"></path>
+                        </svg>
+                        <p style="margin-left:8px;">无</p>
+                      </div>
+                    </t-option>
                     <t-option :key="0" :value="0">
                       <svg
                         xmlns="http://www.w3.org/2000/svg"

+ 13 - 3
src/views/components/pen.ts

@@ -1,5 +1,5 @@
 export const updatePen = (pen: any, prop: string, render = true) => {
-  const v: any = { id: pen.id };
+    const v: any = { id: pen.id };
   v[prop] = pen[prop];
   if (prop === 'width' && pen.ratio) {
     const rect = meta2d.findOne(pen.id);
@@ -30,7 +30,13 @@ export const updatePen = (pen: any, prop: string, render = true) => {
   } else if (prop === 'titleFnJs') {
     v.titleFn = null;
   } else if (prop === 'dash') {
-    v.lineDash = lineDashObj[v[prop]];
+    if(v[prop] === -1) {
+      v.lineDash = undefined;
+      v.lineWidth = 0;
+    }else{
+      v.lineWidth = pen.lineWidth || 1;
+      v.lineDash = lineDashObj[v[prop]];
+    }
   } else if (prop === 'whiteSpace') {
     if(!pen.whiteSpace || pen.whiteSpace !== 'break-all') {
       pen.whiteSpace = 'break-all';
@@ -52,8 +58,12 @@ export const updatePen = (pen: any, prop: string, render = true) => {
       v.height = btnHeight + gap * 2; 
       v.width = btnWidth  * len + gap * (len + 1);
     }
+  } else if(prop === 'lineWidth') {
+    if(v[prop] === undefined){
+      v[prop] = 1;
+    }
   }
-  meta2d.setValue(v, { render });
+    meta2d.setValue(v, { render });
 };
 
 export const lineDashObj = [