Analysis
Overview
The page border is currently drawn entirely outside the page. This makes the page bigger than its expected size and could cause problems with printing and fullscreen mode for example.
Task requirements
- The page border should be drawn inside the page boundaries.
- The page border should not change the page size
- The page content area should not include borders (see the picture below)
+--PAGE--------------------------+ | top | | +---------------------------+ | |l | |r| |e | |i| |f | Page Content |g| |t | |h| | | |t| | | | | | +---------------------------+ | | | | bottom | +--------------------------------+
Task result
The result of this task is code.
Implementation idea
Change the page border position and the page background and page content size.
Related
How to demo
Since there will be no visible difference now, show this wiki page.
Design
The only class that needs to be changed is:
org.sophie2.main.app.commons.page.areas.PageWorkArea
- pageBorder().pageBorder.compute()
The page bounds should coincide with the margin bounds.
Using the BoundMode enumeration we could get the content/border bounds in the following way:
Rectangle rect = new Rectangle(page().get().getParent().pageSize().get().toDimension()); ImmRect content = BoundMode.MARGIN.setRect(new ImmRect(rect), paddingInsets, borderInsets, marginsInsets); ImmRect inBorder = BoundMode.IN_BORDER.getRect(content, paddingInsets, borderInsets, marginsInsets); ImmRect outBorder = BoundMode.OUT_BORDER.getRect(content, paddingInsets, borderInsets, marginsInsets);
For now all padding and margin widths will set to 0, but when they are implemented no changes will be necessary.
- pageBackground().pageBackground.compute()
The page background rectangle should not be the whole page, it should exclude the margins and the page border.
Therefore the shape() property of the scene should be set to the inner border rectangle.
Test: [2799]
Design related code committed to trunk: [2843]
Implementation
Done according to the design: [2951], [2954].
Merged to the trunk in [2955].
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)