Skip to content

Commit dba139b

Browse files
Simplify the edit view to improve performance
1 parent ca32a76 commit dba139b

File tree

2 files changed

+44
-41
lines changed

2 files changed

+44
-41
lines changed

MCMaps/Red Window/Views/Detail/Cells/RedWindowPinHeader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct RedWindowPinHeader: RedWindowDetailCell {
4242

4343
var body: some View {
4444
Group {
45-
if let coverImage {
45+
if let coverImage, !isEditing {
4646
ZStack {
4747
Color.black
4848
Rectangle()

MCMaps/Red Window/Views/Detail/RedWindowPinDetailView.swift

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ struct RedWindowPinDetailView: View {
5858
if !tags.isEmpty {
5959
RedWindowPinTagsCell(pin: $pin, isEditing: $editMode, file: $file)
6060
}
61-
RedWindowPinGalleryCell(pin: $pin, isEditing: $editMode, file: $file)
61+
if !editMode {
62+
RedWindowPinGalleryCell(pin: $pin, isEditing: $editMode, file: $file)
63+
}
6264
}
6365
.padding(.horizontal)
6466
}
@@ -68,9 +70,7 @@ struct RedWindowPinDetailView: View {
6870
}
6971
.ignoresSafeArea(edges: .vertical)
7072
.animation(.interactiveSpring, value: tabBarPlacement)
71-
// NOTE(alicerunsonfedora): The animation causes a flashing problem for some reason. Disabled to as to not
72-
// induce seizures from any potential players.
73-
// .animation(.default, value: editMode)
73+
.animation(.interactiveSpring, value: editMode)
7474
.task {
7575
center = pin.position
7676
if let currentColor = pin.color {
@@ -123,56 +123,59 @@ struct RedWindowPinDetailView: View {
123123
}
124124
}
125125
.toolbar {
126-
ToolbarItem {
127-
Button("Show on Map", semanticIcon: .goHere) {
128-
env.mapCenterCoordinate = pin.position
129-
env.currentRoute = .map
126+
if !editMode {
127+
ToolbarItem {
128+
Button("Show on Map", semanticIcon: .goHere) {
129+
env.mapCenterCoordinate = pin.position
130+
env.currentRoute = .map
131+
}
130132
}
131-
}
132133

133-
#if RED_WINDOW
134-
if #available(macOS 16, iOS 19, *) {
135-
ToolbarSpacer(.fixed)
136-
}
137-
#endif
134+
#if RED_WINDOW
135+
if #available(macOS 16, iOS 19, *) {
136+
ToolbarSpacer(.fixed)
137+
}
138+
#endif
139+
}
138140

139141
ToolbarItem {
140142
editButton
141143
}
142144

143-
#if RED_WINDOW
144-
if #available(macOS 16, iOS 19, *) {
145-
ToolbarSpacer(.fixed)
145+
if !editMode {
146+
#if RED_WINDOW
147+
if #available(macOS 16, iOS 19, *) {
148+
ToolbarSpacer(.fixed)
149+
}
150+
#endif
151+
ToolbarItem {
152+
pinCustomizationMenu
146153
}
147-
#endif
148-
149-
ToolbarItem {
150-
pinCustomizationMenu
151-
}
152154

153-
ToolbarItem {
154-
Menu("Pin Dimension", systemImage: SemanticIcon.dimensionSelect.rawValue) {
155-
#if os(iOS)
156-
Label("Pin Dimension", semanticIcon: .dimensionSelect)
157-
.foregroundStyle(.secondary)
158-
#endif
159-
WorldCodedDimensionPicker(selection: $pin.dimension)
155+
ToolbarItem {
156+
Menu("Pin Dimension", systemImage: SemanticIcon.dimensionSelect.rawValue) {
157+
#if os(iOS)
158+
Label("Pin Dimension", semanticIcon: .dimensionSelect)
159+
.foregroundStyle(.secondary)
160+
#endif
161+
WorldCodedDimensionPicker(selection: $pin.dimension)
162+
}
160163
}
161-
}
162164

163-
ToolbarItem {
164-
Button("Manage Tags…", systemImage: "tag") {
165-
presentTagEditor.toggle()
165+
ToolbarItem {
166+
Button("Manage Tags…", systemImage: "tag") {
167+
presentTagEditor.toggle()
168+
}
166169
}
167-
}
168170

169-
#if RED_WINDOW
170-
if #available(macOS 16, iOS 19, *) {
171-
ToolbarSpacer(.fixed)
172-
}
173-
#endif
171+
#if RED_WINDOW
172+
if #available(macOS 16, iOS 19, *) {
173+
ToolbarSpacer(.fixed)
174+
}
175+
#endif
174176

175-
photoUploadToolbar
177+
photoUploadToolbar
178+
}
176179
}
177180
}
178181

0 commit comments

Comments
 (0)