Constructor
new Imprint()
Initializes the Imprint icon, loads its image, sets its position, and
attaches the necessary event listeners.
- Source:
Methods
getMouseCoordinates(event) → {Object}
Calculates the mouse or touch coordinates relative to the canvas.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MouseEvent | TouchEvent | The event triggered by user interaction. |
- Source:
Returns:
An object containing the calculated x and y coordinates.
- Type
- Object
handleClick(mouseX, mouseY)
Checks if the provided coordinates are within the bounds of the imprint icon.
If they are and the game has not started, navigates to "imprint.html".
Parameters:
| Name | Type | Description |
|---|---|---|
mouseX |
number | The x coordinate relative to the canvas. |
mouseY |
number | The y coordinate relative to the canvas. |
- Source:
onClick(event)
Handles click and touchstart events.
Calculates the coordinates and processes the navigation if conditions are met.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MouseEvent | TouchEvent | The user interaction event. |
- Source:
onRelease(event)
Handles mouseup and touchend events, preventing default behavior.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MouseEvent | TouchEvent | The user interaction event. |
- Source:
updatePosition()
Updates the position of the imprint icon based on the current canvas size.
- Source: