Skip to content

Layout scale bars and grids: fixes after #2660 #2698

Closed

Description

@jgregoriorincon

Follow-up to #2660 (#2581 part 2), which merged before its last review round was pushed. The CodeRabbit review on 8ec911b and the review passes after it found these. Each one is fixed and tested on a branch, ready for a PR.

Bugs

  • A locked scale bar takes "textSize": null. ElementKind::null_resets counts textSize only for legends, so layout.update with "textSize": null on a locked scale bar passes the lock and gives it back 8 pt. It should be refused, as for a legend, unless the same command gives "locked": false.
  • A scale bar moved with x or y isn't measured. Its labels can be moved off the page without the in-app notice; only the export reports it. Resizing (w/h), its size, units and divisions are already measured.
  • A short scale bar's end label can overlap its first at a large size, with no notice. Both labels are always drawn, and the box check looks only at the end label's right side. Example: 12 pt in a 48 px box.
  • A grid label larger than a short frame is drawn and then cut by the frame. kept_labels checks a label's room along its edge but not across the frame. Example: labelSize 100 on a frame about 10 mm tall.

Publication

  • The scale box isn't re-measured when its frame's centre or map changes. The text under the bar can name {center} and {map}, and the bar's ground length follows the map, but only a change of scale or w re-measures the box.

Smaller

  • For scale bars alone, the export's cut-off advice reads "make the scale bar larger" first and is always singular. It should name moving it inside the page and making its box larger, in the singular or plural by count.
  • layout.import's capability check parses the imported layout once per key. One read is enough.

Proposed fix

  • null_resets covers a scale bar's textSize.
  • layout.update measures a scale bar given x or y.
  • Above the default size, an end label running into the first makes the box too small, which is said.
  • A grid label reaching further in than the frame is across is left out, as a label without room is. This applies at every size, so on a frame smaller across than a default label (about 5 mm) the label is left out instead of cut.
  • The publication box basis records the frame's map, and a change of center or map re-measures it. The width before the change is measured on the old map and centre, the width after on the new ones.
  • The advice above, and imported_layout_uses taking all of a capability's keys.

Each fix has a regression test that fails without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions