From bf9e4680eb466bcb7c9cb1bef567252bb1f2bb7d Mon Sep 17 00:00:00 2001 From: Runt <qingingrunt2010@qq.com> Date: Fri, 27 Jun 2025 05:32:55 +0000 Subject: [PATCH] 1 --- LiveProject/shape/IconBack.swift | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/LiveProject/shape/IconBack.swift b/LiveProject/shape/IconBack.swift index 0856c3b..5d760f8 100644 --- a/LiveProject/shape/IconBack.swift +++ b/LiveProject/shape/IconBack.swift @@ -5,4 +5,32 @@ // Created by 倪路朋 on 6/26/25. // -import Foundation +import SwiftUI + +struct IconBack: Shape { + + func path(in rect: CGRect) -> Path { + var path = Path() + + let arrowHeadLength = rect.width * 0.4 + let shaftY = rect.midY + let headHeight = rect.height * 0.5 + + // 箭头头部(三角形) + path.move(to: CGPoint(x: arrowHeadLength, y: rect.minY)) + path.addLine(to: CGPoint(x: 0, y: shaftY)) + path.addLine(to: CGPoint(x: arrowHeadLength, y: rect.maxY)) + + // 箭身(横线) + path.move(to: CGPoint(x: 0, y: shaftY)) + path.addLine(to: CGPoint(x: rect.maxX, y: shaftY)) + return path + } +} + +struct IconBack_Previews : PreviewProvider{ + static var previews: some View { + IconBack() + .stroke(Color.primary, lineWidth: 3).frame(width: 30,height: 25) + } +} -- Gitblit v1.9.1