forked from MapComplete/MapComplete
		
	UX: hide layers without name from search, search for those layers in the themesearch (see #2157)
This commit is contained in:
		
							parent
							
								
									556c26d99b
								
							
						
					
					
						commit
						03db69f1a0
					
				
					 2 changed files with 4 additions and 3 deletions
				
			
		|  | @ -1,4 +1,3 @@ | ||||||
| import Constants from "../../Models/Constants" |  | ||||||
| import SearchUtils from "./SearchUtils" | import SearchUtils from "./SearchUtils" | ||||||
| import ThemeSearch from "./ThemeSearch" | import ThemeSearch from "./ThemeSearch" | ||||||
| import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | ||||||
|  | @ -12,7 +11,9 @@ export default class LayerSearch { | ||||||
| 
 | 
 | ||||||
|     constructor(layout: LayoutConfig) { |     constructor(layout: LayoutConfig) { | ||||||
|         this._layout = layout |         this._layout = layout | ||||||
|         this._layerWhitelist = new Set(layout.layers.map(l => l.id).filter(id => Constants.added_by_default.indexOf(<any>id) < 0)) |         this._layerWhitelist = new Set(layout.layers | ||||||
|  |             .filter(l => l.isNormal()) | ||||||
|  |             .map(l => l.id)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     static scoreLayers(query: string, options: { |     static scoreLayers(query: string, options: { | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ export default class ThemeSearch { | ||||||
|     private readonly _otherThemes: MinimalLayoutInformation[] |     private readonly _otherThemes: MinimalLayoutInformation[] | ||||||
| 
 | 
 | ||||||
|     constructor(state: {osmConnection: OsmConnection, layout: LayoutConfig}) { |     constructor(state: {osmConnection: OsmConnection, layout: LayoutConfig}) { | ||||||
|         this._layersToIgnore = state.layout.layers.map(l => l.id) |         this._layersToIgnore = state.layout.layers.filter(l => l.isNormal()).map(l => l.id) | ||||||
|         this._knownHiddenThemes = UserRelatedState.initDiscoveredHiddenThemes(state.osmConnection).map(list => new Set(list)) |         this._knownHiddenThemes = UserRelatedState.initDiscoveredHiddenThemes(state.osmConnection).map(list => new Set(list)) | ||||||
|         this._otherThemes = ThemeSearch.officialThemes.themes |         this._otherThemes = ThemeSearch.officialThemes.themes | ||||||
|             .filter(th => th.id !== state.layout.id) |             .filter(th => th.id !== state.layout.id) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue