- make UBDrawingController::mActiveRuler private
- use guarded pointer to avoid dangling pointer dereferencing
- provide public accessor functions
- consider a ruler active only if it is visible
- when using the pen tool on a ruler the "normal" cursor was shown
- instead the special drawRulerLine cursor should be shown
- UBGraphicsScene::drawPenCircle update cursor only with no active ruler
- Basically simulate a device release with the previous tool and a
device press with the new tool to correctly terminate the previous
action.
- Hide the eraser when switching to another tool.
Distance between the last drawn point and the current point is
calculated to be able to discard very short stroke segments (i.e we only
add to the current stroke if the input device has moved more than a
certain distance since the last drawn point).
This commit moves this code from the stroke to the scene, which allows
to calculate distance more accurately: it is now calculated as the
total, absolute distance traveled since the last point, rather than simply the
length of a line between the last point and current one.
This ensures that when part of a line is erased,
`UBGraphicsStroke::isNominalLine` will no longer return true. This was
problematic as `UBSvgSubsetAdaptor` uses this to know whether or not to
save a stroke as polyline.
If it saves the stroke as a polyline, then the erased portions of the stroke
reappear after saving.
Therefore, we now force saving of the stroke as a group of polygons when it
has been partially erased.
This fixes two related issues:
1) When taking a partial screenshot of the desktop, then copying it
(Ctrl-C) and pasting it in a new document, it was not saved
2) When a page of one document was copied into another (in document
mode, by dragging the page onto another document), media files
disappeared from the new page.
Previously, only transforms were saved -- not positions (which are set
if a group is moved by dragging it directly; if dragged by its frame,
its transform is updated instead).
Issue observed was that a group that had been moved would lose its new
position when the document was saved then loaded. (All other transforms
were kept, however).
Now, when duplicating a group before saving a document, position is
included in the group's transform.
This allows users to change the color of the background grid e.g if they
are using a projector or other low-contrast display.
The settings are in the `Board` category and are named `CrossColorDarkBackground`
and `CrossColorLightBackground`. They take strings representing the
color in any of the following formats:
- #RGB (Hexadecimal digits)
- #RRGGBB
- #AARRGGBB
- #RRRGGGBBB
- #RRRRGGGGBBBB
- Any SVG color keyword name (as defined by W3C)
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).