Skip to content
Snippets Groups Projects
Commit 7a71a016 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

deltaY highlighting

parent 65541ec6
Branches
No related tags found
No related merge requests found
Pipeline #13372 passed
......@@ -150,6 +150,10 @@ const transformHighlightedText = (
/[áčďéěíňóřšťúůýžÁČĎÉĚÍŇÓŘŠŤÚÝŽ]+/.test(text)
)
const textContainsHighlight = (
/\*/.test(text)
)
let positionWithinLine = 0
let linePosition = 0
let highlightIsActive = false
......@@ -175,6 +179,10 @@ const transformHighlightedText = (
style.fill = highlightedTextColor
}
if (options.padWhenDiacritics && textContainsHighlight && textContainsDiacritics) {
style.deltaY = Math.ceil(fontSize * 0.1)
}
styles[linePosition][positionWithinLine] = style
positionWithinLine++
......
......@@ -109,7 +109,8 @@ const redraw = async (canvas, options) => {
mainTextWidth,
'Bebas Neue',
options.colors.highlight.value,
options.colors.highlightedText.value
options.colors.highlightedText.value,
{padWhenDiacritics: true}
)
mainTextBox = new PaddedHighlightingTextbox(
......
......@@ -100,7 +100,8 @@ const redraw = async (canvas, options) => {
textBoxWidth,
'Bebas Neue',
options.colors.highlight.value,
options.colors.highlightedText.value
options.colors.highlightedText.value,
{padWhenDiacritics: true}
)
textBox = new PaddedHighlightingTextbox(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment