Adding tests for the <Map> component.

This commit is contained in:
Eric van der Vlist 2022-10-19 13:55:44 +02:00
parent b3a8f60f1e
commit b5dd10e920
1 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import react, { useCallback, useState } from 'react';
import react, { useCallback } from 'react';
import { atom, useAtom } from 'jotai';
import Handlers from './Handlers';
@ -8,12 +8,26 @@ import { Point, TileFactory } from './types';
export interface MapProperties {}
const initialCoordinateSystem = {
/**
* Definition of a coordinate system
*
* The coordinate system is shifted and zoomed (from the viewport origin)
*
*/
export interface CoordinateSystem {
/** Zoom relative to the origin */
zoom: number;
/** Origin's shift (in pixels) */
shift: Point;
}
const initialCoordinateSystem: CoordinateSystem = {
zoom: 1,
shift: { x: 0, y: 0 },
};
const coordinateSystemAtom = atom(initialCoordinateSystem);
/** An atom to store the map coordinates system */
export const coordinateSystemAtom = atom(initialCoordinateSystem);
/**
* Description of coordinates system transformation