editor: use css variable --grid-width at startup (allow overriding) and after disabling & enabling the grid

This commit is contained in:
bordun 2021-04-21 16:35:54 +02:00
parent 1c5876246b
commit db165faa9f
4 changed files with 9 additions and 4 deletions

View file

@ -4,6 +4,7 @@
- bug fixes
- button: all writing strings like `"1.0"` in `label` without removing the decimals
- editor: use css variable `--grid-width` at startup (allow overriding) and after disabling & enabling the grid
- midi
- allow sending note off with velocity

View file

@ -405,9 +405,9 @@ class Editor {
this.grid = !this.grid
GRIDWIDTH = this.grid ? 10 : 1
GRIDWIDTH = this.grid ? GRIDWIDTH_CSS : 1
document.documentElement.style.setProperty('--grid-width', GRIDWIDTH)
document.body.style.setProperty('--grid-width', GRIDWIDTH)
document.body.classList.toggle('no-grid', GRIDWIDTH == 1)
}

View file

@ -11,7 +11,9 @@ window.PACKAGE = require('../../package.json')
window.LOADING = null
window.READ_ONLY = window.READ_ONLY || false
window.GRIDWIDTH = 10
window.GRIDWIDTH_CSS = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--grid-width'))
window.GRIDWIDTH = GRIDWIDTH_CSS
window.ELECTRON_NOGPU = false

View file

@ -98,7 +98,9 @@ module.exports = {
setTimeout(()=>{
var root = widgetManager.getWidgetById('root')[0]
if (root) root.onPropChanged('color')
GRIDWIDTH = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--grid-width'))
GRIDWIDTH_CSS = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--grid-width'))
editor.toggleGrid()
editor.toggleGrid()
},200)