Поправки мелких багов

This commit is contained in:
Book Pauk
2019-01-17 01:46:41 +07:00
parent 439296bf04
commit 6aee902e34
2 changed files with 10 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ class TextPage extends Vue {
this.canvas = this.$refs.canvas; this.canvas = this.$refs.canvas;
this.context = this.canvas.getContext('2d'); this.context = this.canvas.getContext('2d');
this.context.textAlign = 'left'; this.context.textAlign = 'left';
this.context.textBaseline = 'bottom';
} }
calcDrawProps() { calcDrawProps() {

View File

@@ -237,7 +237,7 @@ export default class BookParser {
'Б', 'В', 'Г', 'Д', 'Ж', 'З', 'Й', 'К', 'Л', 'М', 'Н', 'П', 'Р', 'С', 'Т', 'Ф', 'Х', 'Ч', 'Ц', 'Ш', 'Щ' 'Б', 'В', 'Г', 'Д', 'Ж', 'З', 'Й', 'К', 'Л', 'М', 'Н', 'П', 'Р', 'С', 'Т', 'Ф', 'Х', 'Ч', 'Ц', 'Ш', 'Щ'
]); ]);
const znak = new Set(['ь', 'Ь', 'ъ', 'Ъ', 'й', 'Й']); const znak = new Set(['ь', 'Ь', 'ъ', 'Ъ', 'й', 'Й']);
const alpha = new Set([...glas, ...soglas, ...znak, ' ']); const alpha = new Set([...glas, ...soglas, ...znak]);
let slog = ''; let slog = '';
let slogLen = 0; let slogLen = 0;
@@ -260,13 +260,18 @@ export default class BookParser {
alpha.has(word[i + 1]) && alpha.has(word[i + 2]) alpha.has(word[i + 1]) && alpha.has(word[i + 2])
) || ) ||
//мягкий или твердый знак или Й //мягкий или твердый знак или Й
(znak.has(word[i])) (znak.has(word[i])) ||
(word[i] == '-')
) && ) &&
//нельзя оставлять окончания на ь, ъ, й //нельзя оставлять окончания на ь, ъ, й
!(znak.has(word[i + 2]) && !alpha.has(word[i + 3])) !(znak.has(word[i + 2]) && !alpha.has(word[i + 3]))
) { ) {
result.push(slog); if (word[i] != '-')
result.push(slog);
else {
result.push(slog.substr(0, slog.length - 1));
}
slog = ''; slog = '';
slogLen = 0; slogLen = 0;
} }