open-pioneer / trails-openlayers-base-packages

Common OpenLayers packages for the Open Pioneer Trails client framework.
Apache License 2.0
8 stars 6 forks source link

[Map Printing] Printing does not consider the map's view padding #311

Closed antoniave closed 3 months ago

antoniave commented 5 months ago

In OpenLayers it is possible to define a padding for a map's view to define a part of the map that is covered by other elements. For example, this is used to display the result list underneath the app in the demo. Usually, when using the view padding some parts of the map are not visible for the user and the contents of the map and the center of the map is shifted.

However, when using the Trails' map print function, currently the whole map is printed - the view padding is not taken into account. Hence, a feature shown in the middle of the map is not printed in the middle of the map if a view padding is used.

Thus, the view padding should be considered when generating the map image for printing.

mbeckem commented 5 months ago

Implementation hint: fetch viewpadding from map model during print and remove the "hidden" parts from the exported canvas. Provide an option on the printing widget / printing api to disable the new feature (i.e. restore current behavior).