forked from MapComplete/MapComplete
		
	PDF-export: the time-sensitive icons (notably hopening_hours) are now hidden
This commit is contained in:
		
							parent
							
								
									fb193123e0
								
							
						
					
					
						commit
						24b9f045c8
					
				
					 5 changed files with 14 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -63,7 +63,8 @@
 | 
			
		|||
          },
 | 
			
		||||
          "then": "circle:#f0f;clock:#fff"
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
      ],
 | 
			
		||||
      "metacondition": "__showTimeSensitiveIcons!=no"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "id": "phonelink",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,7 +86,7 @@
 | 
			
		|||
                "_direction:leftright~*"
 | 
			
		||||
              ]
 | 
			
		||||
            },
 | 
			
		||||
            "then": "100,35,center"
 | 
			
		||||
            "then": "50,35,center"
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        "render": "35,35,center"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,8 @@
 | 
			
		|||
    isExporting = true
 | 
			
		||||
    const gpsLayer = state.layerState.filteredLayers.get(<PriviligedLayerType>"gps_location")
 | 
			
		||||
    state.lastClickObject.features.setData([])
 | 
			
		||||
 | 
			
		||||
    state.userRelatedState.preferencesAsTags.data["__showTimeSensitiveIcons"] = "no"
 | 
			
		||||
    state.userRelatedState.preferencesAsTags.ping()
 | 
			
		||||
    const gpsIsDisplayed = gpsLayer.isDisplayed.data
 | 
			
		||||
    try {
 | 
			
		||||
      gpsLayer.isDisplayed.setData(false)
 | 
			
		||||
| 
						 | 
				
			
			@ -68,6 +69,9 @@
 | 
			
		|||
    } finally {
 | 
			
		||||
      isExporting = false
 | 
			
		||||
      gpsLayer.isDisplayed.setData(gpsIsDisplayed)
 | 
			
		||||
      state.userRelatedState.preferencesAsTags.data["__showTimeSensitiveIcons"] = "yes"
 | 
			
		||||
      state.userRelatedState.preferencesAsTags.ping()
 | 
			
		||||
      
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,12 +27,14 @@ class PointRenderingLayer {
 | 
			
		|||
    private readonly _allMarkers: Map<string, Marker> = new Map<string, Marker>()
 | 
			
		||||
    private readonly _selectedElement: Store<{ properties: { id?: string } }>
 | 
			
		||||
    private readonly _markedAsSelected: HTMLElement[] = []
 | 
			
		||||
    private readonly _metatags: Store<Record<string, string>>
 | 
			
		||||
    private _dirty = false
 | 
			
		||||
 | 
			
		||||
    constructor(
 | 
			
		||||
        map: MlMap,
 | 
			
		||||
        features: FeatureSource,
 | 
			
		||||
        config: PointRenderingConfig,
 | 
			
		||||
        metatags?: Store<Record<string, string>>,
 | 
			
		||||
        visibility?: Store<boolean>,
 | 
			
		||||
        fetchStore?: (id: string) => Store<Record<string, string>>,
 | 
			
		||||
        onClick?: (feature: Feature) => void,
 | 
			
		||||
| 
						 | 
				
			
			@ -41,6 +43,7 @@ class PointRenderingLayer {
 | 
			
		|||
        this._visibility = visibility
 | 
			
		||||
        this._config = config
 | 
			
		||||
        this._map = map
 | 
			
		||||
        this._metatags = metatags
 | 
			
		||||
        this._fetchStore = fetchStore
 | 
			
		||||
        this._onClick = onClick
 | 
			
		||||
        this._selectedElement = selectedElement
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +146,7 @@ class PointRenderingLayer {
 | 
			
		|||
        } else {
 | 
			
		||||
            store = new ImmutableStore(<OsmTags>feature.properties)
 | 
			
		||||
        }
 | 
			
		||||
        const { html, iconAnchor } = this._config.RenderIcon(store)
 | 
			
		||||
        const { html, iconAnchor } = this._config.RenderIcon(store, { metatags: this._metatags })
 | 
			
		||||
        html.SetClass("marker")
 | 
			
		||||
        if (this._onClick !== undefined) {
 | 
			
		||||
            html.SetClass("cursor-pointer")
 | 
			
		||||
| 
						 | 
				
			
			@ -525,6 +528,7 @@ export default class ShowDataLayer {
 | 
			
		|||
                    map,
 | 
			
		||||
                    features,
 | 
			
		||||
                    pointRenderingConfig,
 | 
			
		||||
                    this._options.metaTags,
 | 
			
		||||
                    doShowLayer,
 | 
			
		||||
                    fetchStore,
 | 
			
		||||
                    onClick,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,4 +35,5 @@ export interface ShowDataLayerOptions {
 | 
			
		|||
    fetchStore?: (id: string) => Store<Record<string, string>>
 | 
			
		||||
 | 
			
		||||
    onClick?: (feature: Feature) => void
 | 
			
		||||
    metaTags?: Store<Record<string, string>>
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue