Skip to content

Subdivisions for ruler assistants

This merge requests adds equally spaced subdivisions to the ruler and infinite ruler assistant tools. They are configurable through the assistants docker where the number of subdivisions and minor subdivisions can be set. Also, the rulers can be set to have a fixed length in an arbitrary unit.

To see the changes in action, refer to the feedback thread on the forum where I also posted screenshots.

Test Plan / Feature Presentation

  1. Create a ruler or infinite ruler assistant in a document or load one with saved rulers. By default, they should behave exactly the same as before.
  2. Change the number of subdivisions in the assistants docker. The sliders should only appear when a ruler assistant is selected. The ruler should update immediately. For the infinite ruler, only the center part is drawn until a drawing tool is selected.
  3. Try zooming and rotating the canvas; the tickmarks should stay the same size on screen and stay perpendicular to the ruler itself.
  4. Try zooming far out or increase the number of subdivisions on a ruler very high. If the lines get too close together, they should stop rendering before two adjacent ones become indistinguishable due to the pixel resolution.
  5. Tick the fixed length checkbox; the length editor should appear beneath and display the current length of the ruler in the given unit (by default px). One of the ruler's handles will now only move the entire ruler while the other will rotate around the first only. This should also be indicated in the UI.
  6. Change the fixed length unit. Unless the value is changed as well (e.g. by clicking into the text box and pressing enter), this will not change the stored unit or value of the ruler to avoid rounding errors accumulating. Instead, the box will display with a prefix whether the ruler's length converted perfectly (=) or was rounded (≈) when displaying it as the newly selected unit. Deselecting and re-selecting the ruler loads the originally saved unit, which is displayed without prefix.
  7. Also the perspective assistant should have a subdivision slider now, rather than a hardcoded value.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (I did not find any assistant-related tests; tell me if there are some I missed.)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Julian Schmidt

Merge request reports