fix #21 change sizes when selecting bitmaps
This commit is contained in:
parent
0653fdc615
commit
ff8d49e37d
20
index.js
20
index.js
|
@ -48,6 +48,9 @@ const selectFont = () => {
|
||||||
|
|
||||||
if (typeof fontData !== 'undefined' && fontData[font].rendering === 'bitmap') {
|
if (typeof fontData !== 'undefined' && fontData[font].rendering === 'bitmap') {
|
||||||
codeMirror.classList.add('no-smooth')
|
codeMirror.classList.add('no-smooth')
|
||||||
|
if (fontData[font]['bitmap size']) {
|
||||||
|
setSize(fontData[font]['bitmap size'])
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
codeMirror.classList.remove('no-smooth')
|
codeMirror.classList.remove('no-smooth')
|
||||||
}
|
}
|
||||||
|
@ -74,13 +77,11 @@ const selectFont = () => {
|
||||||
document.cookie = `font=${font};max-age=172800`
|
document.cookie = `font=${font};max-age=172800`
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onhashchange = () => {
|
function setSize (px) {
|
||||||
plausible('Font Selected')
|
let size = document.getElementById('size').value
|
||||||
selectFont()
|
if (px) {
|
||||||
}
|
size = px
|
||||||
|
}
|
||||||
function setSize () {
|
|
||||||
const size = document.getElementById('size').value
|
|
||||||
|
|
||||||
document.querySelector('.CodeMirror').style.fontSize = `${size}px`
|
document.querySelector('.CodeMirror').style.fontSize = `${size}px`
|
||||||
document.cookie = `size=${size};max-age=172800`
|
document.cookie = `size=${size};max-age=172800`
|
||||||
|
@ -330,6 +331,11 @@ function toggleFilter (filter) {
|
||||||
applyFilters()
|
applyFilters()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.onhashchange = () => {
|
||||||
|
plausible('Font Selected')
|
||||||
|
selectFont()
|
||||||
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
const cookieValueSpacing = document.cookie.replace(/(?:(?:^|.*;\s*)spacing\s*=\s*([^;]*).*$)|^.*$/, '$1')
|
const cookieValueSpacing = document.cookie.replace(/(?:(?:^|.*;\s*)spacing\s*=\s*([^;]*).*$)|^.*$/, '$1')
|
||||||
const cookieValueSize = document.cookie.replace(/(?:(?:^|.*;\s*)size\s*=\s*([^;]*).*$)|^.*$/, '$1')
|
const cookieValueSize = document.cookie.replace(/(?:(?:^|.*;\s*)size\s*=\s*([^;]*).*$)|^.*$/, '$1')
|
||||||
|
|
Loading…
Reference in New Issue