forked from MapComplete/MapComplete
		
	Themes: don't show 'mark as unknown' if this would break the source-filter
This commit is contained in:
		
							parent
							
								
									6a9b985070
								
							
						
					
					
						commit
						76a9a2ee23
					
				
					 2 changed files with 16 additions and 5 deletions
				
			
		|  | @ -18,6 +18,7 @@ import { GeoOperations } from "../../Logic/GeoOperations" | |||
| import { Feature } from "geojson" | ||||
| import MarkdownUtils from "../../Utils/MarkdownUtils" | ||||
| import { UploadableTag } from "../../Logic/Tags/TagTypes" | ||||
| import LayerConfig from "./LayerConfig" | ||||
| 
 | ||||
| export interface Mapping { | ||||
|     readonly if: UploadableTag | ||||
|  | @ -924,7 +925,7 @@ export default class TagRenderingConfig { | |||
|      * The keys that should be erased if one has to revert to 'unknown'. | ||||
|      * Might give undefined if setting to unknown is not possible | ||||
|      */ | ||||
|     public removeToSetUnknown(): string[] | undefined { | ||||
|     public removeToSetUnknown(partOfLayer: LayerConfig, currentTags: Record<string, string>): string[] | undefined { | ||||
|         const toDelete = new Set<string>() | ||||
|         if (this.freeform) { | ||||
|             toDelete.add(this.freeform.key) | ||||
|  | @ -949,6 +950,16 @@ export default class TagRenderingConfig { | |||
|             } | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         currentTags = { ...currentTags } | ||||
|         for (const key of toDelete) { | ||||
|             delete currentTags[key] | ||||
|         } | ||||
|         const required = partOfLayer.source.osmTags | ||||
|         if (!required.matchesProperties(currentTags)) { | ||||
|             return undefined | ||||
|         } | ||||
| 
 | ||||
|         return Array.from(toDelete) | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue