Skip to main content

Exported functions

src/pages/utils.js
calculateLayout :: [] -> undefined

Calculate the layout of the home page, the left and right sidebars, the
rest of the script adds event listeners to the elements in the layout so
that the layout follows the mouse cursor when clicked and dragged.
src/rooms/canvas/utils.js
getPlacementData :: [] -> {color: string, x: number, y: number}

Get the placement data, i.e. the color the user has selected and the
coordinates of the pixel he is focusing on.

toggleTooltip :: [state: boolean] -> undefined

Get the currently focused pixel's information and display it in the
tooltip.

calculateTarget :: [event: *] -> {x: number, y: number}

Calculate the target position according to the top left corner of the canvas.

positionUpdate :: [event: *] -> undefined

Update the position tooltip.

positionDisplay :: [{x: number, y: number}] -> undefined

Update the position tooltip.

transformHexTo32Bits :: [hex: string] -> number

Transform #RRGGBB to 0xBBGGRRAA. Hexadecimal color to 32 bits integer.

renderCanvas :: [pixels: number[], colors: string[]] -> undefined

Render the canvas.

initCanvas :: [roomConfig: *, pixels: number[]] -> undefined

Initialize the canvas with the given room configuration and pixels.

renderCanvasUpdate :: [color: string, x: number, y: number] -> undefined

Render the canvas update, i.e. update the pixel at the given coordinates.

resetValues :: [] -> undefined

Reset the values of the canvas, i.e. the zoom, the coordinates and the display
position.
src/utils/notify.js
createAlert :: [title: string, message: string, type: string] -> undefined

Create an alert with the given title, message and type.
The alert will display at the top right corner of the screen.
This is a useful function to notify the user of any errors or warnings.