Formatting and indentation fixes
This commit is contained in:
parent
73fdd4b7eb
commit
1a72b01b31
22 changed files with 690 additions and 691 deletions
|
@ -23,58 +23,58 @@
|
|||
'use strict';
|
||||
|
||||
var runtime, interp, io, iosAudioActive = false;
|
||||
$(function () {
|
||||
$(function() {
|
||||
runtime = new Runtime();
|
||||
runtime.init();
|
||||
|
||||
|
||||
$(window).keydown(function(e) {
|
||||
runtime.keysDown[e.which] = true;
|
||||
runtime.startKeyHats(e.which);
|
||||
});
|
||||
|
||||
|
||||
$(window).keyup(function(e) {
|
||||
delete runtime.keysDown[e.which];
|
||||
});
|
||||
|
||||
|
||||
// Update the project ID field
|
||||
$('#project_id').val(project_id);
|
||||
|
||||
|
||||
// Go project button behavior
|
||||
$('#go_project').click(function() {
|
||||
window.location = "#" + parseInt($('#project_id').val());
|
||||
window.location.reload(true);
|
||||
});
|
||||
|
||||
|
||||
// Green flag behavior
|
||||
$('#trigger_green_flag, #greenSlide').click(function() {
|
||||
$('#greenSlide').css('display', 'none');
|
||||
runtime.greenFlag()
|
||||
});
|
||||
|
||||
|
||||
// Stop button behavior
|
||||
$('#trigger_stop').click(function() {
|
||||
runtime.stopAll();
|
||||
});
|
||||
|
||||
|
||||
// Canvas container mouse events
|
||||
$('#container').mousedown(function(e) {
|
||||
runtime.mouseDown = true;
|
||||
//e.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
$('#container').mouseup(function(e) {
|
||||
runtime.mouseDown = false;
|
||||
//e.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
$('#container').mousemove(function(e) {
|
||||
var absX = e.pageX - this.offsetLeft;
|
||||
var absY = e.pageY - this.offsetTop;
|
||||
runtime.mousePos = [absX-240, -absY+180];
|
||||
});
|
||||
|
||||
|
||||
// Touch events - EXPERIMENTAL
|
||||
$(window).bind('touchstart', function(e) {
|
||||
$(window).bind('touchstart', function(e) {
|
||||
// On iOS, we need to activate the Web Audio API
|
||||
// with an empty sound play on the first touch event.
|
||||
if (!iosAudioActive) {
|
||||
|
@ -85,8 +85,8 @@ $(function () {
|
|||
isource.noteOn(0);
|
||||
iosAudioActive = true;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#container').bind('touchstart', function(e) {
|
||||
runtime.mouseDown = true;
|
||||
});
|
||||
|
@ -94,14 +94,14 @@ $(function () {
|
|||
$('#container').bind('touchend', function(e) {
|
||||
runtime.mouseDown = true;
|
||||
});
|
||||
|
||||
|
||||
$('#container').bind('touchmove', function(e) {
|
||||
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
||||
var absX = touch.pageX - this.offsetLeft;
|
||||
var absY = touch.pageY - this.offsetTop;
|
||||
runtime.mousePos = [absX-240, -absY+180];
|
||||
});
|
||||
|
||||
|
||||
// Border touch events - EXPERIMENTAL
|
||||
$('#left').bind('touchstart touchmove', function(e) { runtime.keysDown[37] = true; runtime.startKeyHats(37); });
|
||||
$('#left').bind('touchend', function(e) { delete runtime.keysDown[37]; });
|
||||
|
@ -111,11 +111,11 @@ $(function () {
|
|||
$('#right').bind('touchend', function(e) { delete runtime.keysDown[39]; });
|
||||
$('#down').bind('touchstart touchmove', function(e) { runtime.keysDown[40] = true; runtime.startKeyHats(40); });
|
||||
$('#down').bind('touchend', function(e) { delete runtime.keysDown[40]; });
|
||||
|
||||
|
||||
// Load the interpreter and primitives
|
||||
interp = new Interpreter();
|
||||
interp.initPrims();
|
||||
|
||||
|
||||
// Load the requested project and go!
|
||||
io = new IO();
|
||||
io.loadProject(project_id);
|
||||
|
|
Reference in a new issue