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.
- 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
- 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)
- Removed inheritance of UBGraphicsProxyWidget; cleaned up related code
- Added two children classes: UBGraphicsVideoItem and
UBGraphicsAudioItem. UBGraphicsMediaItem is now an abstract class.
- Better encapsulation; the Scene and other external classes no longer
access the mediaObject directly
There is now less distinction between audio and video items to outside
code: apart from the UBSvgSubsetAdaptor, there is no need to know
whether a media item holds a video or audio file. Creation is handled
through the static function `UBGraphicsMediaItem::createMediaItem(URL,
parent)`
1st we remove original widget, then we disable undo stack, create a copy of widget and make it a tool. Then undo stack enables back. That widget has tool as parent, so we not need to manage him by scene.