forked from MapComplete/MapComplete
		
	UI: fix rendering of icons in addNewPoint, fix #1722
This commit is contained in:
		
							parent
							
								
									872e36dffa
								
							
						
					
					
						commit
						ef3eb4fcd0
					
				
					 3 changed files with 18 additions and 13 deletions
				
			
		|  | @ -80,8 +80,10 @@ | |||
|         "pointRendering": [ | ||||
|           { | ||||
|             "=marker": [ | ||||
|               {"icon": "circle", | ||||
|                 "color": "white"}, | ||||
|               { | ||||
|                 "icon": "circle:white;./assets/themes/onwheels/entrance.svg" | ||||
|                 "icon": "./assets/themes/onwheels/entrance.svg" | ||||
|               } | ||||
|             ] | ||||
|           } | ||||
|  | @ -258,6 +260,7 @@ | |||
|     { | ||||
|       "builtin": "parking_spaces", | ||||
|       "override": { | ||||
|         "id": "parking_spaces_disabled", | ||||
|         "source": { | ||||
|           "osmTags": "parking_space=disabled" | ||||
|         }, | ||||
|  | @ -410,9 +413,10 @@ | |||
|         "syncSelection": "theme-only", | ||||
|         "pointRendering": [ | ||||
|           { | ||||
|             "=marker": [ | ||||
|             "=marker": [  {"icon": "circle", | ||||
|               "color": "white"}, | ||||
|               { | ||||
|                 "icon": "circle:white;./assets/themes/onwheels/elevator.svg" | ||||
|                 "icon": "./assets/themes/onwheels/elevator.svg" | ||||
|               } | ||||
|             ], | ||||
|             "iconSize": "40,40", | ||||
|  |  | |||
|  | @ -79,7 +79,6 @@ export default class PointRenderingConfig extends WithContextLoader { | |||
|             } | ||||
|         }) | ||||
| 
 | ||||
| 
 | ||||
|         this.marker = (json.marker ?? []).map((m) => new IconConfig(<any>m)) | ||||
|         if (json.css !== undefined) { | ||||
|             this.cssDef = this.tr("css", undefined) | ||||
|  | @ -199,13 +198,14 @@ export default class PointRenderingConfig extends WithContextLoader { | |||
| 
 | ||||
|         if (options?.noSize) { | ||||
|             iconAndBadges.SetClass("w-full h-full") | ||||
|         } else { | ||||
|             tags.map((tags) => this.iconSize.GetRenderValue(tags).Subs(tags).txt ?? "[40,40]").map( | ||||
|                 (size) => { | ||||
|                     const [iconW, iconH] = size.split(",").map((x) => num(x)) | ||||
|                     iconAndBadges.SetStyle(`width: ${iconW}px; height: ${iconH}px`) | ||||
|                 } | ||||
|             ) | ||||
|         } | ||||
|         tags.map((tags) => this.iconSize.GetRenderValue(tags).Subs(tags).txt ?? "[40,40]").map( | ||||
|             (size) => { | ||||
|                 const [iconW, iconH] = size.split(",").map((x) => num(x)) | ||||
|                 iconAndBadges.SetStyle(`width: ${iconW}px; height: ${iconH}px`) | ||||
|             } | ||||
|         ) | ||||
| 
 | ||||
|         const css = this.cssDef?.GetRenderValue(tags.data)?.txt | ||||
|         const cssClasses = this.cssClasses?.GetRenderValue(tags.data)?.txt | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ | |||
|   import NextButton from "../../Base/NextButton.svelte" | ||||
|   import ToSvelte from "../../Base/ToSvelte.svelte" | ||||
|   import BaseUIElement from "../../BaseUIElement" | ||||
|   import Combine from "../../Base/Combine" | ||||
| 
 | ||||
|   /** | ||||
|    * This component lists all the presets and allows the user to select one | ||||
|  | @ -54,9 +55,9 @@ | |||
|     for (const preset of layer.presets) { | ||||
|       const tags = TagUtils.KVtoProperties(preset.tags ?? []) | ||||
| 
 | ||||
|       const icon: BaseUIElement = layer.mapRendering[0] | ||||
|         .RenderIcon(new ImmutableStore<any>(tags)) | ||||
|         .html.SetClass("w-12 h-12 block relative mr-4") | ||||
|       const markers = layer.mapRendering.map((mr, i) => mr.RenderIcon(new ImmutableStore<any>(tags), {noSize: i == 0}) | ||||
|         .html.SetClass(i == 0 ? "w-full h-full" : "")) | ||||
|       const icon: BaseUIElement = new Combine(markers.map(m => new Combine([m]).SetClass("absolute top-0 left-0 w-full h-full flex justify-around items-center"))).SetClass("w-12 h-12 block relative mr-4") | ||||
| 
 | ||||
|       const description = preset.description?.FirstSentence() | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue