mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
feat(studio): give a book its first and its last page (#2317)
A new book was a cover, a spread and a back cover, so it opened straight onto pages 2 and 3. A bound book does not: the inside of the cover is blank, and the first thing facing the reader is a single right-hand page, page 1. The same at the end, where a single left-hand page sits before the back cover. Both are laid down now, empty, in a new book and in a laid-out one, and they are fixed the way the covers are: an inner spread only ever goes between them. The page numbers follow. They were counted from a spread's position in the array, which assumed the spread after the cover was the first, and three places did that sum on their own. One function now counts along the book, one page for a single leaf and two for a spread, so the sheet on screen and the label in the print view and the folio on the page all say the same number. A book with a first page starts at 1; a book from before the first page existed has none and keeps the numbers it always had.
This commit is contained in:
@@ -730,8 +730,17 @@ export type BookUnits = z.infer<typeof bookUnitsSchema>;
|
||||
|
||||
export const bookSpreadSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
/** 'cover' and 'back' are single pages; everything else is a double spread. */
|
||||
role: z.enum(['cover', 'back', 'inner']).default('inner'),
|
||||
/**
|
||||
* Which leaf of the bound book this is.
|
||||
*
|
||||
* 'inner' is a double spread; the other four are single pages. 'cover' and
|
||||
* 'back' are the outside of the book. 'first' is the right-hand page a book
|
||||
* opens onto, and 'last' the left-hand page before the back cover: the
|
||||
* inside of each cover is blank in a bound book, so the first and the last
|
||||
* inner page stand alone rather than facing anything (#2317). Both are
|
||||
* optional so that a document from before they existed still reads.
|
||||
*/
|
||||
role: z.enum(['cover', 'first', 'inner', 'last', 'back']).default('inner'),
|
||||
background: hex.nullable().default(null),
|
||||
/** Back to front. */
|
||||
elements: z.array(bookElementSchema).max(MAX_SPREAD_ELEMENTS).default([]),
|
||||
|
||||
Reference in New Issue
Block a user