Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Snap settings build errors #523

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading