Private
configurationThe event listeners for the configuration mode. These are used to remove the event listeners when the configuration mode is disabled.
Private
draggingThe element that is currently being dragged
Whether the user is currently configuring the touch controls. When this is true, the touch controls can be dragged around the screen and the controls of the game are disabled.
Private
isPrivate
overlayPrivate
touchPrivate
changeChanges the state of the touch controls to the given orientation.
Whether the screen is in landscape mode.
Private
createCreates the event listeners for the configuration mode.
The elements that can be dragged around the screen.
The event listeners for the configuration mode.
Private
createCreates an overlay that covers the screen and allows the user to drag the touch controls around. Also enables the toolbar for saving, resetting, and canceling the changes.
The UI of the game.
Private
createInitializes the toolbar of the configuration mode. Places its elements at the top of the touch controls and adds event listeners to them.
Private
createCreates the toolbar element for the configuration mode.
A new div element that contains the toolbar for the configuration mode.
Disables the configuration mode.
Private
dragDrags the currently dragged element to the given pointer position.
The pointer event that is currently happening.
Allows the user to configure the touch controls by dragging buttons around the screen.
The UI of the game.
Private
getReturns the references to the elements of the configuration toolbar.
The references to the elements of the configuration toolbar or undefined if the elements can not be found (e.g. during tests)
Private
getReturns all control groups of the touch controls. These are groups of buttons that can be dragged around the screen.
All control groups of the touch controls.
Private
getReturns the key of the local storage for the control positions data of this orientation
Private
getReturns the current positions of all touch controls that have moved from their default positions of this orientation.
The current positions of all touch controls that have moved from their default positions of this orientation
Private
getReturns the saved positions of the touch controls. Filters result by the given orientation.
The saved positions of the touch controls of this orientation
Private
getPrivate
isElements that are inside the left div are anchored to the left boundary of the screen. The x value of the positions are considered offsets to their respective boundaries.
Either an element in the left div or the right div.
Whether the given element is inside the left div.
Private
resetResets the positions of the touch controls to their default positions and clears the saved positions. Does not save the changes.
Private
saveSaves the current positions of the touch controls to the local storage.
Private
setSets a control element to the given position. The x values are either offsets to the left or right boundary of the screen, depending on the side of the element. E.g. For left elements, (0, 0) is the bottom left corner of the screen and for right elements, (0, 0) is the bottom right corner of the screen.
Either an offset to the left or right boundary of the screen.
An offset to the bottom boundary of the screen.
Private
setUpdates the positions of the touch controls.
The new positions of the touch controls.
Private
startStart dragging the given button.
The button that is being dragged.
Private
stopStops dragging the currently dragged element.
Handles the dragging of touch controls around the screen.