瀏覽代碼

Allow canvas toolbar tools to deselect on second tap.

Tapping an already active text, image, or draw tool returns to pointer mode so users can exit a tool without choosing another.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 月之前
父節點
當前提交
06cb73f8af
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      smart_printer/DrawPrintView.swift

+ 8 - 1
smart_printer/DrawPrintView.swift

@@ -1261,7 +1261,14 @@ final class CanvasToolsPanel: NSView, AppearanceRefreshable {
 
         for tool in CanvasTool.toolbarTools {
             let button = CanvasToolButton(tool: tool)
-            button.onClick = { [weak self] in self?.selectTool(tool) }
+            button.onClick = { [weak self] in
+                guard let self else { return }
+                if self.activeTool == tool {
+                    self.selectTool(.pointer)
+                } else {
+                    self.selectTool(tool)
+                }
+            }
             toolButtons[tool] = button
             toolStack.addArrangedSubview(button)
         }