(event)
| 1198 | let autoLaunchTime = 0; |
| 1199 | |
| 1200 | function updateSpeedFromEvent(event) { |
| 1201 | if (isUpdatingSpeed || event.y >= mainStage.height - 44) { |
| 1202 | // On phones it's hard to hit the edge pixels in order to set speed at 0 or 1, so some padding is provided to make that easier. |
| 1203 | const edge = 16; |
| 1204 | const newSpeed = (event.x - edge) / (mainStage.width - edge * 2); |
| 1205 | simSpeed = Math.min(Math.max(newSpeed, 0), 1); |
| 1206 | // show speed bar after an update |
| 1207 | speedBarOpacity = 1; |
| 1208 | // If we updated the speed, return true |
| 1209 | return true; |
| 1210 | } |
| 1211 | // Return false if the speed wasn't updated |
| 1212 | return false; |
| 1213 | } |
| 1214 | |
| 1215 | // Extracted function to keep `update()` optimized |
| 1216 | function updateGlobals(timeStep, lag) { |
no outgoing calls
no test coverage detected