If enabled in the preferences menu, pen and marker strokes will be
replaced by a simplified stroke after they are drawn.
The algorithm is very basic (for now): if three points are almost lined
up (the threshold angle can be specified in the config file), then the
middle one is removed. This is repeated over the whole stroke; new
polygons are then generated based on the simplified stroke points.
This typically cuts down on number of points and polygons by a factor of
about 10, while having minimal visual impact.
Due to antialiasing, adjacent polygons are separated by a very fine
space. The previous solution attempted to hide this by adding a border
to the polygons. The border of adjacent polygons would overlap, which
was visible (despite the attempted color correction) and, more
importantly, caused massive lags especially on Linux.
Therefore it has been removed but feel free to revert this commit some
day and try to fix this more cleanly.
- The background selection palette now includes a slider to change the
size of the background grid. Default min/max values are 16 and 64px,
defined in UBSettings. Grid resizes dynamically as the slider is moved.
- Measuring tools' (ruler, triangle) markers follow grid size: 1 square
of the background grid corresponds to 1cm
- Grid size can be different for each page of a document
- Grid size is saved in the .svg
- Documents with a background grid but no specified grid size follow the
default size defined in UBSettings.
Previously, grid size was calculated based on DPI, which can vary from
one OS, computer or display to the next. This new setting allows
documents to be migrated from one machine to another with no unexpected
changes in grid size happening. It also makes it easy to correct any
problems importing old documents (whose grid size might be smaller or
larger than expected when imported on a new version of OpenBoard).
In some cases, the PDF background of a document could be scaled badly
when tools such as the ruler, compass etc. were present on the page.
This happened with PDFs of version <= 1.4, and when the tools were
outside of / larger than the page.
- Added a curveToPolygon function that creates a curved polygon,
eliminating the need to generate lots of small ones to make a curve look
smooth.
- Cleaned up the rest of the code a bit
- UBGraphicsScene calls UBGraphicsStroke::addPoint, which returns a list
of points that can be drawn. It may be none (e.g we discard very small
segments), one (if we do no interpolation) or several.
- Added a UBInterpolator base, abstract class. Various interpolation
methods can be added easily.
- Current methods: Basic spline (custom), Catmull-Rom spline (based on
alglib), and Bézier
- Added a setting to toggle interpolation. Added this to the UI as well
- Display a meaningful error message to the user when adding or trying
to play a video
- Make sure the video placeholder is visible even after switching pages
- Sort by Z before duplicating a selection (so that relative Z's are
kept)
- in UBZLayerController, iterate only through UBGraphicsScene's fast
access items, not QGraphicsScene::items
- Defined constants in UBSettings for highlighter preview circle colors
- Switch between light and dark colors when changing backgrounds
- For eraser: use color settings that were defined in UBSettings (they
were ignored since the preview circle was added)
When a video is first loaded (placed on the scene), we play/pause it to
load the first frame; but this was also called when the video was
manually stopped. To avoid this, a mStopped attribute was added to
UBGraphicsMediaItem. It is set to true only when the video is stopped by
the user.