Bug report #19987

Anchor point legend not firmly anchored in template

Added by Gert Jan Pieterse over 5 years ago. Updated over 5 years ago.

Assignee:Nyall Dawson
Category:Map Legend
Affected QGIS version:3.2.1 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27809


I created the following layout templates with legends:

- Legend in the upper-right corner.
- Anchor point in the upper right corner.
- The legend has 'auto-update' turned on.

My problem is that with a new map using this template, the legend moves. I think this is what happens:

- The legend get rescaled with new items, making it longer / shorter and wider / smaller.
- The upper-left corner stays at the same place as in the template.
- The upper-right corner gets recalculated using the upper-left corner and new width.
- The upper-right corner gets anchored again with the new position.

Calculation example:

- template 19x19 cm page
- legend width during making of the template: 5 cm.
- anchor point upper-right corner: X = 19.0 cm, Y = 0.0 cm.
- legend width in new map: 5.5 cm.
- legend upper-left corner: X = 14.0 cm, Y = 0.0 cm.
- legend new anchor point upper-right: X = 19.5 cm, Y = 0.0 cm.

Associated revisions

Revision 530397c1
Added by Nyall Dawson over 5 years ago

[layouts] Fix legend does not respect anchor point when resizing
based on map content

Fixes #19987


#1 Updated by Harrissou Santanna over 5 years ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High
Actually, afaics no need to use a template. An anchor set for a legend in a print layout is not respected:
  1. create a legend item
  2. set an anchor other than the upper left
  3. Use the filter legend by map content : the legend is resized based on the upper left instead of the right.

This is a regression as it should have been fixed since #11321.

#2 Updated by Nyall Dawson over 5 years ago

  • Assignee set to Nyall Dawson
  • Status changed from Open to In Progress

#3 Updated by Nyall Dawson over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF