mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
fix(studio): a line keeps its own colour when a theme is applied, adopted or described
This commit is contained in:
@@ -111,6 +111,8 @@ function linkToLook(el: BookElement, spread: BookSpread, look: BookDesignLook):
|
||||
switch (el.kind) {
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
// A line keeps the colour it was drawn in (book-line.schema.ts has no theme link).
|
||||
case 'line':
|
||||
return el;
|
||||
case 'text': {
|
||||
const token = lookToken(el.color, look, true);
|
||||
|
||||
@@ -61,6 +61,8 @@ function chromaticInks(el: BookElement): string[] {
|
||||
switch (el.kind) {
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
// A line keeps the colour it was drawn in (book-line.schema.ts has no theme link).
|
||||
case 'line':
|
||||
return [];
|
||||
case 'text':
|
||||
case 'icon':
|
||||
@@ -157,6 +159,8 @@ function adoptElement(
|
||||
// A sticker keeps the colours of its slots: they are a drawing, not the page's inks.
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
// A line keeps the colour it was drawn in (book-line.schema.ts has no theme link).
|
||||
case 'line':
|
||||
return el;
|
||||
case 'text': {
|
||||
const token = el.token ?? inkToken(el.color, ground, map, prev, el.size <= 9);
|
||||
|
||||
@@ -66,6 +66,8 @@ export function themedElement<E extends BookElement>(el: E, theme: BookTheme): E
|
||||
switch (el.kind) {
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
// A line keeps the colour it was drawn in (book-line.schema.ts has no theme link).
|
||||
case 'line':
|
||||
return el;
|
||||
case 'text': {
|
||||
tokenColour(next, theme, 'color', el.token);
|
||||
|
||||
@@ -23,7 +23,7 @@ export function bookThemeLine(theme: BookTheme | undefined): string {
|
||||
|
||||
/** What an element follows of the theme, as words for its line ('' when nothing). */
|
||||
export function themeLinkWords(el: BookElement): string {
|
||||
if (el.kind === 'photo' || el.kind === 'sticker') return '';
|
||||
if (el.kind === 'photo' || el.kind === 'sticker' || el.kind === 'line') return '';
|
||||
const parts: string[] = [];
|
||||
if (el.token) parts.push(`${el.kind === 'shape' ? 'fill' : 'colour'} ${el.token}`);
|
||||
if (el.kind === 'shape' && el.strokeToken) parts.push(`stroke ${el.strokeToken}`);
|
||||
|
||||
Reference in New Issue
Block a user