From 492cf57520b416a772790f03a224ec2da737b61f Mon Sep 17 00:00:00 2001 From: stopflock Date: Thu, 20 Nov 2025 21:17:06 -0600 Subject: [PATCH] Disable deletion of nodes attached to ways/relations, add option for visibility of WIP extraction feature --- lib/dev_config.dart | 3 +++ lib/widgets/edit_node_sheet.dart | 30 ++++++++++++++++-------------- lib/widgets/node_tag_sheet.dart | 4 ++-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/dev_config.dart b/lib/dev_config.dart index a411511..76a6e05 100644 --- a/lib/dev_config.dart +++ b/lib/dev_config.dart @@ -65,6 +65,9 @@ const bool kEnableNavigationFeatures = kEnableDevelopmentModes; // Hide navigati // Node editing features - set to false to temporarily disable editing const bool kEnableNodeEdits = true; // Set to false to temporarily disable node editing +// Node extraction features - set to false to hide extract functionality for constrained nodes +const bool kEnableNodeExtraction = false; // Set to true to enable extract from way/relation feature (WIP) + /// Navigation availability: only dev builds, and only when online bool enableNavigationFeatures({required bool offlineMode}) { if (!kEnableDevelopmentModes) { diff --git a/lib/widgets/edit_node_sheet.dart b/lib/widgets/edit_node_sheet.dart index 9f11804..ad7277a 100644 --- a/lib/widgets/edit_node_sheet.dart +++ b/lib/widgets/edit_node_sheet.dart @@ -219,20 +219,22 @@ class EditNodeSheet extends StatelessWidget { padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), child: Column( children: [ - // Extract from way checkbox - CheckboxListTile( - title: Text(locService.t('editNode.extractFromWay')), - subtitle: Text(locService.t('editNode.extractFromWaySubtitle')), - value: session.extractFromWay, - onChanged: (value) { - appState.updateEditSession(extractFromWay: value); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.zero, - ), - const SizedBox(height: 8), - // Constraint info message (only show if extract is not checked) - if (!session.extractFromWay) ...[ + // Extract from way checkbox (only show if enabled in dev config) + if (kEnableNodeExtraction) ...[ + CheckboxListTile( + title: Text(locService.t('editNode.extractFromWay')), + subtitle: Text(locService.t('editNode.extractFromWaySubtitle')), + value: session.extractFromWay, + onChanged: (value) { + appState.updateEditSession(extractFromWay: value); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.zero, + ), + const SizedBox(height: 8), + ], + // Constraint info message (only show if extract is not checked or not enabled) + if (!kEnableNodeExtraction || !session.extractFromWay) ...[ Row( children: [ const Icon(Icons.info_outline, size: 20), diff --git a/lib/widgets/node_tag_sheet.dart b/lib/widgets/node_tag_sheet.dart index 7d9740c..375d945 100644 --- a/lib/widgets/node_tag_sheet.dart +++ b/lib/widgets/node_tag_sheet.dart @@ -209,12 +209,12 @@ class NodeTagSheet extends StatelessWidget { ), const SizedBox(width: 8), ElevatedButton.icon( - onPressed: _deleteNode, + onPressed: node.isConstrained ? null : _deleteNode, icon: const Icon(Icons.delete, size: 18), label: Text(locService.t('actions.delete')), style: ElevatedButton.styleFrom( minimumSize: const Size(0, 36), - foregroundColor: Colors.red, + foregroundColor: node.isConstrained ? null : Colors.red, ), ), const SizedBox(width: 12),