Add right-click Copy Image to diagrams
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user