Add right-click Copy Image to diagrams

This commit is contained in:
Ian Gulliver
2026-10-23 09:08:21 -07:00
parent 41335867ef
commit fe86916ce6
3 changed files with 57 additions and 13 deletions
+14
View File
@@ -1103,6 +1103,7 @@ struct BoxDiagramView: View {
store.openSheet(.diagram(layout), fromTask: inTask)
}
.help("Open full size")
.diagramMenu(layout)
.frame(maxWidth: .infinity, alignment: .leading)
case .failure(let error):
DiagramFailure(source: source, reason: error.reason)
@@ -1166,6 +1167,19 @@ private struct TappableCanvas: View {
.onTapGesture(coordinateSpace: .local) { p in
tap(layout.hit(p))
}
.diagramMenu(layout)
}
}
extension View {
func diagramMenu(_ layout: BoxLayout) -> some View {
contextMenu {
Button("Copy Image") {
if let image = diagramCGImage(layout) {
copyToClipboard(platformImage(image))
}
}
}
}
}