Fix joysticks not being visible by default on mobile
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
import GrahamScan from "./vendor/lucio/graham-scan.mjs";
|
import GrahamScan from "./vendor/lucio/graham-scan.mjs";
|
||||||
|
|
||||||
class Joystick {
|
class Joystick {
|
||||||
constructor(ctx, x, y, radius) {
|
constructor(ctx, x, y, radius, visibleByDefault) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@ -13,7 +13,7 @@ class Joystick {
|
|||||||
this.nubX = x;
|
this.nubX = x;
|
||||||
this.nubY = y;
|
this.nubY = y;
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.visible = false;
|
this.visible = visibleByDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw() {
|
draw() {
|
||||||
@ -892,8 +892,8 @@ function updateModuleDisplays(robot) {
|
|||||||
* BEGIN ANIMATION CODE
|
* BEGIN ANIMATION CODE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const leftJoystick = new Joystick(ctx, -250, 250, 100);
|
const leftJoystick = new Joystick(ctx, -250, 250, 100, supportsTouch);
|
||||||
const rightJoystick = new Joystick(ctx, 250, 250, 100);
|
const rightJoystick = new Joystick(ctx, 250, 250, 100, supportsTouch);
|
||||||
|
|
||||||
function drawGrid(ctx, sideLength, gridSquareSize, xOffset, yOffset) {
|
function drawGrid(ctx, sideLength, gridSquareSize, xOffset, yOffset) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|||||||
Reference in New Issue
Block a user