Update the object, called automatically by plugin once each frame
()
| 825 | |
| 826 | /** Update the object, called automatically by plugin once each frame */ |
| 827 | update() |
| 828 | { |
| 829 | // call the custom update callback |
| 830 | this.onUpdate(); |
| 831 | |
| 832 | // unset active if disabled |
| 833 | if (this.disabled) |
| 834 | { |
| 835 | if (this === uiSystem.activeObject) |
| 836 | uiSystem.activeObject = undefined; |
| 837 | if (this === uiSystem.keyInputObject) |
| 838 | uiSystem.keyInputObject = undefined; |
| 839 | } |
| 840 | |
| 841 | if (uiSystem.keyInputObject) |
| 842 | return; |
| 843 | |
| 844 | const wasHover = uiSystem.lastHoverObject === this; |
| 845 | const isActive = this.isActiveObject(); |
| 846 | const mouseDown = mouseIsDown(0); |
| 847 | const mousePress = this.dragActivate ? mouseDown : mouseWasPressed(0); |
| 848 | if (this.canBeHover) |
| 849 | if (!uiSystem.navigationMode) // no mouse hover in navigation mode |
| 850 | if (mousePress || isActive || (!mouseDown && !isTouchDevice)) |
| 851 | if (!uiSystem.hoverObject && this.isMouseOverlapping()) |
| 852 | uiSystem.hoverObject = this; |
| 853 | if (this.isHoverObject()) |
| 854 | { |
| 855 | if (!this.disabled) |
| 856 | { |
| 857 | if (mousePress) |
| 858 | { |
| 859 | if (this.interactive) |
| 860 | { |
| 861 | if (!this.dragActivate || (!wasHover || mouseWasPressed(0))) |
| 862 | this.onPress(); |
| 863 | this.soundPress && this.soundPress.play(); |
| 864 | if (uiSystem.activeObject && !isActive) |
| 865 | uiSystem.activeObject.onRelease(); |
| 866 | uiSystem.activeObject = this; |
| 867 | |
| 868 | if (uiSystem.activateOnPress) |
| 869 | this.click(!this.soundPress); |
| 870 | } |
| 871 | } |
| 872 | if (!uiSystem.activateOnPress) |
| 873 | if (!mouseDown && this.isActiveObject() && this.interactive) |
| 874 | this.click(); |
| 875 | } |
| 876 | |
| 877 | // clear mouse was pressed state even when disabled |
| 878 | mousePress && inputClearKey(0,0,0,1,0); |
| 879 | } |
| 880 | if (isActive) |
| 881 | if (!mouseDown || (this.dragActivate && !this.isHoverObject())) |
| 882 | { |
| 883 | this.onRelease(); |
| 884 | this.soundRelease && this.soundRelease.play(); |
nothing calls this directly
no test coverage detected