|
@@ -2,7 +2,7 @@
|
|
|
* @Author: LiZhiWei
|
|
|
* @Date: 2025-04-10 14:38:27
|
|
|
* @LastEditors: LiZhiWei
|
|
|
- * @LastEditTime: 2025-04-21 09:59:47
|
|
|
+ * @LastEditTime: 2025-04-21 17:15:13
|
|
|
* @Description:
|
|
|
-->
|
|
|
<template>
|
|
@@ -966,6 +966,48 @@ export default {
|
|
|
|
|
|
svg.appendChild(triangle)
|
|
|
break
|
|
|
+ case 'arc':
|
|
|
+ const arc = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
|
|
+
|
|
|
+ // 计算弧形的参数
|
|
|
+ const arcRadius = Math.min(element.width, element.height) / 2
|
|
|
+
|
|
|
+ // 绘制弧形路径
|
|
|
+ arc.setAttribute(
|
|
|
+ 'd',
|
|
|
+ `M${arcRadius},0 ` +
|
|
|
+ `A${arcRadius},${arcRadius} 0 1 1 ${arcRadius * 0.15},${arcRadius * 0.5}`
|
|
|
+ )
|
|
|
+
|
|
|
+ // 设置填充色
|
|
|
+ arc.setAttribute('fill', 'transparent')
|
|
|
+
|
|
|
+ // 设置边框
|
|
|
+ if (element.borderWidth > 0) {
|
|
|
+ arc.setAttribute('stroke', element.borderColor || '#000')
|
|
|
+ arc.setAttribute('stroke-width', element.borderWidth || 0.5)
|
|
|
+
|
|
|
+ // 处理虚线边框
|
|
|
+ if (element.borderType === 'dotted' || element.borderType === 'dashed') {
|
|
|
+ if (element.borderStrokeDasharray) {
|
|
|
+ arc.setAttribute('stroke-dasharray', element.borderStrokeDasharray)
|
|
|
+ } else if (element.borderType === 'dotted') {
|
|
|
+ arc.setAttribute('stroke-dasharray', '2, 2')
|
|
|
+ arc.setAttribute('stroke-linecap', 'round')
|
|
|
+ } else if (element.borderType === 'dashed') {
|
|
|
+ arc.setAttribute('stroke-dasharray', '6, 3')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ arc.setAttribute('vector-effect', 'non-scaling-stroke')
|
|
|
+ arc.setAttribute('shape-rendering', 'geometricPrecision')
|
|
|
+ }else {
|
|
|
+ arc.setAttribute('stroke', element.borderColor || '#000')
|
|
|
+ arc.setAttribute('stroke-width', 0.5)
|
|
|
+ }
|
|
|
+
|
|
|
+ svg.appendChild(arc)
|
|
|
+ break
|
|
|
case 'custom':
|
|
|
const customPath = document.createElementNS(
|
|
|
'http://www.w3.org/2000/svg',
|