Skip to content

Commit

Permalink
Merge pull request #523 from Esri/Caleb/Fix-SnapSettingsBuildErrors
Browse files Browse the repository at this point in the history
[Fix] Snap settings build errors
  • Loading branch information
CalebRas authored Oct 17, 2024
2 parents e1cf55f + 113820b commit 2f34ab4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Shared/Samples/Snap geometry edits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To more clearly see how the vertex is snapped, long press to invoke the magnifie
3. Create a `GeometryEditor` and connect it to the map view.
4. Call `syncSourceSettings()` after the map's operational layers are loaded and the geometry editor is connected to the map view.
5. Set `SnapSettings.isEnabled` and each `SnapSourceSettings.isEnabled` to `true` for the `SnapSource` of interest.
6. Toggle geometry guides using `SnapSettings.isGeometryGuidesEnabled` and feature snapping using `SnapSettings.isFeatureSnappingEnabled`.
6. Toggle geometry guides using `SnapSettings.snapsToGeometryGuides` and feature snapping using `SnapSettings.snapsToFeatures`.
7. Start the geometry editor with a `GeometryType`.

## Relevant API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension SnapGeometryEditsView {
let geometryEditor: GeometryEditor = {
let geometryEditor = GeometryEditor()
geometryEditor.snapSettings.isEnabled = true
geometryEditor.snapSettings.isGeometryGuidesEnabled = true
geometryEditor.snapSettings.snapsToGeometryGuides = true
return geometryEditor
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ extension SnapGeometryEditsView {
/// for the geometry editor.
@State private var snappingEnabled = false

/// A Boolean value indicating whether snapping to geometry guides is enabled.
@State private var geometryGuidesEnabled = false
/// A Boolean value indicating whether the geometry editor snaps to geometry guides.
@State private var snapsToGeometryGuides = false

/// A Boolean value indicating whether snapping to features and graphics is enabled.
@State private var featureSnappingEnabled = false
/// A Boolean value indicating whether the geometry editor snaps to features and graphics.
@State private var snapsToFeatures = false

/// An array of snap source names and their source settings.
@State private var snapSources: [(name: String, sourceSettings: SnapSourceSettings)] = []
Expand All @@ -47,15 +47,15 @@ extension SnapGeometryEditsView {
model.geometryEditor.snapSettings.isEnabled = newValue
}

Toggle("Geometry Guides", isOn: $geometryGuidesEnabled)
.onChange(of: geometryGuidesEnabled) { newValue in
model.geometryEditor.snapSettings.isGeometryGuidesEnabled = newValue
Toggle("Geometry Guides", isOn: $snapsToGeometryGuides)
.onChange(of: snapsToGeometryGuides) { newValue in
model.geometryEditor.snapSettings.snapsToGeometryGuides = newValue
}
.disabled(!snappingEnabled)

Toggle("Feature Snapping", isOn: $featureSnappingEnabled)
.onChange(of: featureSnappingEnabled) { newValue in
model.geometryEditor.snapSettings.isFeatureSnappingEnabled = newValue
Toggle("Feature Snapping", isOn: $snapsToFeatures)
.onChange(of: snapsToFeatures) { newValue in
model.geometryEditor.snapSettings.snapsToFeatures = newValue
}
.disabled(!snappingEnabled)
}
Expand All @@ -68,7 +68,7 @@ extension SnapGeometryEditsView {
}
}
}
.disabled(!snappingEnabled || !featureSnappingEnabled)
.disabled(!snappingEnabled || !snapsToFeatures)
}
.navigationTitle("Snap Settings")
.navigationBarTitleDisplayMode(.inline)
Expand All @@ -81,8 +81,8 @@ extension SnapGeometryEditsView {
}
.onAppear {
snappingEnabled = model.geometryEditor.snapSettings.isEnabled
geometryGuidesEnabled = model.geometryEditor.snapSettings.isGeometryGuidesEnabled
featureSnappingEnabled = model.geometryEditor.snapSettings.isFeatureSnappingEnabled
snapsToGeometryGuides = model.geometryEditor.snapSettings.snapsToGeometryGuides
snapsToFeatures = model.geometryEditor.snapSettings.snapsToFeatures

// Creates an array from snap source layers or graphics overlays
// with their name and source settings.
Expand Down

0 comments on commit 2f34ab4

Please sign in to comment.