fixed create menu stuff (again)
This commit is contained in:
parent
fe794b69a9
commit
6483de5d9b
|
@ -32,6 +32,10 @@ mineSlider.oninput = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mineBox.addEventListener("input", function() {
|
mineBox.addEventListener("input", function() {
|
||||||
|
mineBox.value = Math.abs(Math.round(mineBox.value.replace(/\D/g,'')))
|
||||||
|
})
|
||||||
|
|
||||||
|
mineBox.addEventListener("change", function() {
|
||||||
updateCount(1)
|
updateCount(1)
|
||||||
menuPicker.select(3)
|
menuPicker.select(3)
|
||||||
})
|
})
|
||||||
|
@ -44,17 +48,19 @@ heightBox.addEventListener("input", function(){
|
||||||
|
|
||||||
heightBox.addEventListener("change", function(){
|
heightBox.addEventListener("change", function(){
|
||||||
heightBox.value = util.clamp(heightBox.value, 8, 500)
|
heightBox.value = util.clamp(heightBox.value, 8, 500)
|
||||||
|
updateCount(2)
|
||||||
menuPicker.select(3)
|
menuPicker.select(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
widthBox.addEventListener("input", function(){
|
widthBox.addEventListener("input", function(){
|
||||||
widthBox.value = util.clamp(Math.abs(Math.round(widthBox.value.replace(/\D/g,''))), 8, 500)
|
widthBox.value = Math.abs(Math.round(widthBox.value.replace(/\D/g,'')))
|
||||||
updateCount(2)
|
updateCount(2)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
widthBox.addEventListener("change", function(){
|
widthBox.addEventListener("change", function(){
|
||||||
widthBox.value = util.clamp(widthBox.value, 8, 500)
|
widthBox.value = util.clamp(widthBox.value, 8, 500)
|
||||||
|
updateCount(2)
|
||||||
menuPicker.select(3)
|
menuPicker.select(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -105,10 +111,10 @@ function updateCount(mode) {
|
||||||
|
|
||||||
if (mode === 0) {
|
if (mode === 0) {
|
||||||
mines = Math.round((mineSlider.value/10) * (width*height) /100)
|
mines = Math.round((mineSlider.value/10) * (width*height) /100)
|
||||||
|
|
||||||
updateCount(2)
|
updateCount(2)
|
||||||
}
|
}
|
||||||
else if (mode === 1) {
|
else if (mode === 1) {
|
||||||
mineBox.value = Math.abs(Math.round(mineBox.value))
|
|
||||||
mines = mineBox.value;
|
mines = mineBox.value;
|
||||||
|
|
||||||
updateCount(2)
|
updateCount(2)
|
||||||
|
@ -140,6 +146,7 @@ function minMines(width, height) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePercentageLabel(percentage) {
|
function updatePercentageLabel(percentage) {
|
||||||
|
if (percentage !== percentage) {percentage = 0}
|
||||||
mineSliderNumber.textContent = `${percentage}%`
|
mineSliderNumber.textContent = `${percentage}%`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue