fix bug where pressing enter updated shader instead of camera distance

This commit is contained in:
gbrochar 2020-11-24 17:04:33 +01:00
parent 4fb99acd00
commit 6a1b25777d
2 changed files with 6 additions and 6 deletions

View File

@ -254,13 +254,13 @@ async function main() {
$('#input1').on('keypress', function(event: any) {
if (event.which === 13) {
event.preventDefault();
$('#button3').click();
$('#changedistance').click();
}
});
$('#input2').on('keypress', function(event: any) {
if (event.which === 13) {
event.preventDefault();
$('#button4').click();
$('#changecirclesize').click();
}
});
$('#button1').on('click', function() {
@ -275,11 +275,11 @@ async function main() {
[programInfo, fragmentShader] = changeFragmentShader(gl,
shaderProgram, fragmentShader, fsSource3, vsSource);
});
$('#button3').on('click', function() {
$('#changedistance').on('click', function() {
distance = $('#input1').val();
distance = parseFloat(distance);
});
$('#button4').on('click', function() {
$('#changecirclesize').on('click', function() {
circleSize = $('#input2').val();
circleSize = parseFloat(circleSize);
});

View File

@ -21,12 +21,12 @@
</div>
<div class='ui-block'>
<input id='input1' value='50'></input>
<button id='button3'>Change camera distance</button>
<button id='changedistance'>Change camera distance</button>
<div style='display: inline'>Max distance is 1000</div>
</div>
<div class='ui-block'>
<input id='input2' value='5'></input>
<button id='button4'>Change circle size</button>
<button id='changecirclesize'>Change circle size</button>
</div>
<div class='ui-block'>
<button id='sphere'>Set obj to sphere</button>