mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
fix(studio): a template's figures stay its design, never the next template's date line
Figures a template draws as design, a film's timecode or a frame number, came back as the page's words when another template was laid on the page, and took its date line. Texts with no letter that are not a date and are bound to nothing are design now, and the new templates spell their plate numbers and REC marks so they read as such.
This commit is contained in:
@@ -705,7 +705,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
opacity: 1,
|
||||
locked: false,
|
||||
kind: 'text',
|
||||
text: 'N° 01',
|
||||
text: '01',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -953,7 +953,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
opacity: 1,
|
||||
locked: false,
|
||||
kind: 'text',
|
||||
text: 'N° 01',
|
||||
text: '01',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -2667,7 +2667,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-01',
|
||||
kind: 'text',
|
||||
text: 'N° 01',
|
||||
text: '01',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -2726,7 +2726,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-02',
|
||||
kind: 'text',
|
||||
text: 'N° 02',
|
||||
text: '02',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -2785,7 +2785,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-03',
|
||||
kind: 'text',
|
||||
text: 'N° 03',
|
||||
text: '03',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -2844,7 +2844,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-04',
|
||||
kind: 'text',
|
||||
text: 'N° 04',
|
||||
text: '04',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -2903,7 +2903,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-05',
|
||||
kind: 'text',
|
||||
text: 'N° 05',
|
||||
text: '05',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -2962,7 +2962,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-06',
|
||||
kind: 'text',
|
||||
text: 'N° 06',
|
||||
text: '06',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -3021,7 +3021,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-07',
|
||||
kind: 'text',
|
||||
text: 'N° 07',
|
||||
text: '07',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
@@ -3080,7 +3080,7 @@ export const NEW_FIELD_NOTES: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'sheet-08',
|
||||
kind: 'text',
|
||||
text: 'N° 08',
|
||||
text: '08',
|
||||
font: 'mono',
|
||||
size: 0.0305,
|
||||
weight: 400,
|
||||
|
||||
@@ -206,7 +206,7 @@ export const NEW_NIGHT_FILM: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'rec',
|
||||
kind: 'text',
|
||||
text: 'REC',
|
||||
text: '●',
|
||||
font: 'mono',
|
||||
size: 0.0333,
|
||||
weight: 400,
|
||||
@@ -786,7 +786,7 @@ export const NEW_NIGHT_FILM: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'rec',
|
||||
kind: 'text',
|
||||
text: 'REC',
|
||||
text: '●',
|
||||
font: 'mono',
|
||||
size: 0.0333,
|
||||
weight: 400,
|
||||
@@ -1103,7 +1103,7 @@ export const NEW_NIGHT_FILM: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'rec',
|
||||
kind: 'text',
|
||||
text: 'REC',
|
||||
text: '●',
|
||||
font: 'mono',
|
||||
size: 0.0333,
|
||||
weight: 400,
|
||||
@@ -1305,7 +1305,7 @@ export const NEW_NIGHT_FILM: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'rec',
|
||||
kind: 'text',
|
||||
text: 'REC',
|
||||
text: '●',
|
||||
font: 'mono',
|
||||
size: 0.0333,
|
||||
weight: 400,
|
||||
@@ -1982,7 +1982,7 @@ export const NEW_NIGHT_FILM: readonly BookDecoratedTemplate[] = [
|
||||
locked: false,
|
||||
group: 'rec',
|
||||
kind: 'text',
|
||||
text: 'REC',
|
||||
text: '●',
|
||||
font: 'mono',
|
||||
size: 0.0333,
|
||||
weight: 400,
|
||||
|
||||
@@ -24,7 +24,13 @@ import {
|
||||
templatePage,
|
||||
type LaidElement,
|
||||
} from './template-lay';
|
||||
import { assignTemplateTexts, textRolesOf, type BookTemplateWord, type BookTemplateWords } from './template-words';
|
||||
import {
|
||||
assignTemplateTexts,
|
||||
isTemplateFigureText,
|
||||
textRolesOf,
|
||||
type BookTemplateWord,
|
||||
type BookTemplateWords,
|
||||
} from './template-words';
|
||||
|
||||
/**
|
||||
* Laying a page out on a decorated template.
|
||||
@@ -146,7 +152,9 @@ function poolOf(spread: BookSpread): Pool {
|
||||
const all = [...spread.elements.filter((e) => !e.locked), ...spread.parked];
|
||||
return {
|
||||
photos: all.filter((e): e is BookPhotoElement => e.kind === 'photo' && e.photoId != null),
|
||||
texts: all.filter((e): e is TextEl => e.kind === 'text' && !!e.text.trim() && !isBookOrnamentText(e)),
|
||||
texts: all.filter(
|
||||
(e): e is TextEl => e.kind === 'text' && !!e.text.trim() && !isBookOrnamentText(e) && !isTemplateFigureText(e),
|
||||
),
|
||||
map: all.find((e): e is BookMapElement => e.kind === 'map'),
|
||||
marks: all.filter((e): e is BookBadgeElement => e.kind === 'badge'),
|
||||
};
|
||||
|
||||
@@ -59,6 +59,15 @@ const SPARE_ORDER: readonly BookTemplateTextRole[] = ['subtitle', 'date', 'capti
|
||||
const DATE_LIKE = /\b(1[89]|20)\d{2}\b|\b\d{1,2}[./]\d{1,2}\b/;
|
||||
|
||||
const isText = (e: BookElement | null | undefined): e is TextEl => !!e && e.kind === 'text' && !!e.text.trim();
|
||||
|
||||
/**
|
||||
* Figures a template drew as its design (a film's timecode, frame numbers, a
|
||||
* plate's number): no letters and not a date, and bound to nothing. They are
|
||||
* not the page's words, so a template laid next never takes one for a title
|
||||
* or a date line.
|
||||
*/
|
||||
export const isTemplateFigureText = (e: BookElement): boolean =>
|
||||
e.kind === 'text' && !e.binding && !/\p{L}/u.test(e.text) && !DATE_LIKE.test(e.text);
|
||||
const isLong = (t: TextEl) => t.text.trim().length > SHORT;
|
||||
|
||||
/** The role a short text reads as on its own: a date line when it says a date, else a subtitle. */
|
||||
|
||||
Reference in New Issue
Block a user