mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Remove disabled state cacheing for the delete operation
This commit is contained in:
@@ -16,7 +16,6 @@ export function operationDelete(selectedIDs, context) {
|
||||
var extent = nodes.reduce(function(extent, node) {
|
||||
return extent.extend(node.extent(context.graph()));
|
||||
}, geoExtent());
|
||||
var _disabled;
|
||||
|
||||
|
||||
var operation = function() {
|
||||
@@ -72,23 +71,22 @@ export function operationDelete(selectedIDs, context) {
|
||||
|
||||
|
||||
operation.disabled = function() {
|
||||
if (_disabled !== undefined) return _disabled;
|
||||
|
||||
if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) {
|
||||
return _disabled = 'too_large';
|
||||
return 'too_large';
|
||||
} else if (someMissing()) {
|
||||
return _disabled = 'not_downloaded';
|
||||
return 'not_downloaded';
|
||||
} else if (selectedIDs.some(context.hasHiddenConnections)) {
|
||||
return _disabled = 'connected_to_hidden';
|
||||
return 'connected_to_hidden';
|
||||
} else if (selectedIDs.some(protectedMember)) {
|
||||
return _disabled = 'part_of_relation';
|
||||
return 'part_of_relation';
|
||||
} else if (selectedIDs.some(incompleteRelation)) {
|
||||
return _disabled = 'incomplete_relation';
|
||||
return 'incomplete_relation';
|
||||
} else if (selectedIDs.some(hasWikidataTag)) {
|
||||
return _disabled = 'has_wikidata_tag';
|
||||
return 'has_wikidata_tag';
|
||||
}
|
||||
|
||||
return _disabled = false;
|
||||
return false;
|
||||
|
||||
|
||||
function someMissing() {
|
||||
|
||||
Reference in New Issue
Block a user