This repository was archived by the owner on Nov 7, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
VisuStruct-iOS/VisuStructXcodeOpen/VisuStruct Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2007,7 +2007,9 @@ struct ContentView: View {
20072007 tabs [ i ] . lineEditorText = el . textLines . joined ( separator : " \n " )
20082008 tabsModel . tabs = tabs
20092009
2010- if ! isPhone , focusedField == nil , el . type != . forSchleife {
2010+ if DiagramInspectorAutoFocus . shouldFocusOnSelection ,
2011+ focusedField == nil ,
2012+ el . type != . forSchleife {
20112013 focusedField = . textEditor
20122014 editorFocusToken = UUID ( )
20132015 }
Original file line number Diff line number Diff line change @@ -110,6 +110,8 @@ private struct CodeLineEditorUIKit: UIViewRepresentable {
110110 tv . commitOnReturn = commitOnReturn
111111 tv . onCommit = onCommit
112112 tv . delegate = context . coordinator
113+ // Beim Erzeugen nicht fokussieren: Nur ein späterer Token-Wechsel holt die Tastatur.
114+ context . coordinator . lastFocusToken = focusToken
113115 return tv
114116 }
115117
Original file line number Diff line number Diff line change 11import SwiftUI
2+ #if canImport( GameController )
3+ import GameController
4+ #endif
5+ #if canImport( UIKit )
6+ import UIKit
7+ #endif
28
39/// Gemeinsame Fokus-Markierung für Diagrammtitel, Inspector-Felder und Zeileneditor.
410enum DiagramEditorFocusTarget : Hashable {
@@ -8,3 +14,32 @@ enum DiagramEditorFocusTarget: Hashable {
814 /// Zählschleife: drei Kopf-Felder (Start / Bedingung / Schritt).
915 case forLoopPart ( Int )
1016}
17+
18+ /// Ob der Inspector nach einer Zeilenauswahl automatisch den Cursor bekommt.
19+ ///
20+ /// Auf dem iPhone nie (zu wenig Platz). Auf dem Mac (Designed for iPad) immer.
21+ /// Auf dem iPad nur, wenn eine Hardware-Tastatur verbunden ist — sonst würde die
22+ /// Software-Tastatur das Diagramm verdecken.
23+ enum DiagramInspectorAutoFocus {
24+ static var shouldFocusOnSelection : Bool {
25+ if ProcessInfo . processInfo . isiOSAppOnMac {
26+ return true
27+ }
28+ #if canImport( UIKit )
29+ switch UIDevice . current . userInterfaceIdiom {
30+ case . phone :
31+ return false
32+ case . pad :
33+ #if canImport( GameController )
34+ return GCKeyboard . coalesced != nil
35+ #else
36+ return false
37+ #endif
38+ default :
39+ return false
40+ }
41+ #else
42+ return false
43+ #endif
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments