()
| 1326 | this.interactive = true; |
| 1327 | } |
| 1328 | update() |
| 1329 | { |
| 1330 | super.update(); |
| 1331 | if (!this.interactive) |
| 1332 | return; |
| 1333 | |
| 1334 | const oldValue = this.value; |
| 1335 | if (this.isActiveObject()) |
| 1336 | { |
| 1337 | // handle horizontal or vertical slider |
| 1338 | const isHorizontal = this.size.x > this.size.y; |
| 1339 | const handleSize = isHorizontal ? this.size.y : this.size.x; |
| 1340 | const barSize = isHorizontal ? this.size.x : this.size.y; |
| 1341 | const centerPos = isHorizontal ? this.pos.x : this.pos.y; |
| 1342 | |
| 1343 | // check if value changed |
| 1344 | const handleWidth = barSize - handleSize; |
| 1345 | const p1 = centerPos - handleWidth/2; |
| 1346 | const p2 = centerPos + handleWidth/2; |
| 1347 | const p = uiSystem.screenToNative(mousePosScreen); |
| 1348 | this.value = isHorizontal ? |
| 1349 | percent(p.x, p1, p2) : |
| 1350 | percent(p.y, p2, p1); |
| 1351 | } |
| 1352 | else if (this.isNavigationObject()) |
| 1353 | { |
| 1354 | // gamepad/keyboard navigation adjustment |
| 1355 | const direction = uiSystem.getNavigationOtherDirection(); |
| 1356 | if (!uiSystem.navigationTimer.active()) |
| 1357 | this.value = clamp(this.value + direction*.01); |
| 1358 | } |
| 1359 | this.value === oldValue || this.onChange(); |
| 1360 | } |
| 1361 | render() |
| 1362 | { |
| 1363 | super.render(); |
nothing calls this directly
no test coverage detected