editor: grid width input safe vs NaN and trigger update on any change
This commit is contained in:
parent
ecd2cbeb24
commit
932558e338
1 changed files with 2 additions and 1 deletions
|
|
@ -129,8 +129,9 @@ module.exports = {
|
|||
w = $('<div class="input-wrapper"><label>Grid</label></div>').appendTo(f),
|
||||
i = $('<input type="number" step="1" min="1" max="100"></div>').appendTo(w)
|
||||
i.val(GRIDWIDTH)
|
||||
i.change(()=>{
|
||||
i.on('keyup mouseup change mousewheel',()=>{
|
||||
var v = Math.max(Math.min(parseInt(i.val()),100),1)
|
||||
if (isNaN(v)) return
|
||||
i.val(v)
|
||||
GRIDWIDTH = v
|
||||
document.documentElement.style.setProperty("--grid-width",GRIDWIDTH)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue