diff --git a/script.js b/script.js index 15a0340..eae0e64 100644 --- a/script.js +++ b/script.js @@ -5,7 +5,7 @@ import GrahamScan from "./vendor/lucio/graham-scan.mjs"; class Joystick { - constructor(ctx, x, y, radius) { + constructor(ctx, x, y, radius, visibleByDefault) { this.ctx = ctx; this.x = x; this.y = y; @@ -13,7 +13,7 @@ class Joystick { this.nubX = x; this.nubY = y; this.active = false; - this.visible = false; + this.visible = visibleByDefault; } draw() { @@ -892,8 +892,8 @@ function updateModuleDisplays(robot) { * BEGIN ANIMATION CODE */ -const leftJoystick = new Joystick(ctx, -250, 250, 100); -const rightJoystick = new Joystick(ctx, 250, 250, 100); +const leftJoystick = new Joystick(ctx, -250, 250, 100, supportsTouch); +const rightJoystick = new Joystick(ctx, 250, 250, 100, supportsTouch); function drawGrid(ctx, sideLength, gridSquareSize, xOffset, yOffset) { ctx.save();