Quellcode durchsuchen

fix: move must be toggled to make hidden tags/notes work properly

Sam Jaffe vor 3 Wochen
Ursprung
Commit
cc4c6c5119
2 geänderte Dateien mit 13 neuen und 6 gelöschten Zeilen
  1. 12 5
      Todos/View/ProjectPanelView.swift
  2. 1 1
      Todos/View/TaskView.swift

+ 12 - 5
Todos/View/ProjectPanelView.swift

@@ -14,6 +14,7 @@ struct ProjectPanelView: View {
 
   @Bindable var item: Project
   @State private var empty = Category()
+  @State private var move = false
 
   var body: some View {
     let style = Date.FormatStyle(date: .numeric, time: .standard)
@@ -27,6 +28,8 @@ struct ProjectPanelView: View {
       }
       .help("New Task")
       .padding(.trailing, 10)
+      Toggle("Move Tasks", isOn: $move)
+        .padding(.trailing, 10)
     }
     HStack {
       if let grp = $allGroups.first(where: { $0.name.wrappedValue == item.category }) {
@@ -56,14 +59,18 @@ struct ProjectPanelView: View {
                 deleteItem(item: subtask.wrappedValue, from: task.wrappedValue)
               }
             }
-        }.onMove(perform: { indices, index in
+        }
+        .onMove(perform: { indices, index in
           withAnimation {
             task.subtasks.wrappedValue.move(fromOffsets: indices, toOffset: index)
           }
-        })
-      }.onMove(perform: { indices, index in
-        item.tasks.move(fromOffsets: indices, toOffset: index)
-      })
+        }).moveDisabled(!move)
+      }
+      .onMove(perform: { indices, index in
+        withAnimation {
+          item.tasks.move(fromOffsets: indices, toOffset: index)
+        }
+      }).moveDisabled(!move)
     }
   }
     

+ 1 - 1
Todos/View/TaskView.swift

@@ -55,7 +55,6 @@ struct TaskView: View {
           TagBarView(task: $task)
             .font(.footnote)
             .padding(.leading, 30)
-          VisibilityTapper(hideToggle: $hideTags)
           if isFocused {
             Picker("", selection: $task.category) {
               Text(empty.name).tag("")
@@ -65,6 +64,7 @@ struct TaskView: View {
             }
             .fixedSize(horizontal: true, vertical: false)
           }
+          VisibilityTapper(hideToggle: $hideTags)
         }.focused($isFocused)
       }