فهرست منبع

fix: halfFrame根据fmla计算

李志伟 2 ماه پیش
والد
کامیت
099b128613
1فایلهای تغییر یافته به همراه11 افزوده شده و 9 حذف شده
  1. 11 9
      src/components/view_file/vendors/pptx/PPT.vue

+ 11 - 9
src/components/view_file/vendors/pptx/PPT.vue

@@ -2,7 +2,7 @@
  * @Author: LiZhiWei
  * @Date: 2025-04-10 14:38:27
  * @LastEditors: LiZhiWei
- * @LastEditTime: 2025-04-29 10:32:14
+ * @LastEditTime: 2025-04-29 14:33:47
  * @Description:
 -->
 <template>
@@ -1569,8 +1569,10 @@ export default {
           )
 
           // 计算内框的边距
-          const frameWidth2 = element.width / 9
-
+          const halfFrameFmlaTop = element.formulas[0].split(" ")[1]
+          const halfFrameFmlaLeft = element.formulas[1].split(" ")[1]
+          const frameWidthTop = element.height * (halfFrameFmlaTop / 100000)
+          const frameWidthLeft = element.width * (halfFrameFmlaLeft / 100000)
           // 绘制外框的左边和上边
           outerRect2.setAttribute(
             "d",
@@ -1580,9 +1582,9 @@ export default {
           // 绘制内框的左边和上边,注意起点位置调整
           innerRect2.setAttribute(
             "d",
-            `M${frameWidth2},${element.height - frameWidth2} ` +
-              `L${frameWidth2},${frameWidth2} ` +
-              `L${element.width - frameWidth2},${frameWidth2}`
+            `M${frameWidthLeft},${element.height - frameWidthLeft} ` +
+              `L${frameWidthLeft},${frameWidthTop} ` +
+              `L${element.width - frameWidthTop},${frameWidthTop}`
           )
 
           // 设置填充色
@@ -1594,12 +1596,12 @@ export default {
             )
             fillPath.setAttribute(
               "d",
-              `M${frameWidth2},${frameWidth2} ` +
-                `L${element.width - frameWidth2},${frameWidth2} ` +
+              `M${frameWidthLeft},${frameWidthTop} ` +
+                `L${element.width - frameWidthTop},${frameWidthTop} ` +
                 `L${element.width},0 ` +
                 `L0,0 ` +
                 `L0,${element.height} ` +
-                `L${frameWidth2},${element.height - frameWidth2} Z`
+                `L${frameWidthLeft},${element.height - frameWidthLeft} Z`
             )
             fillPath.setAttribute("fill", element.fill.value || "transparent")
             svg.appendChild(fillPath)