From b5dd10e92077ce960d629e9f7fbe9466673b7958 Mon Sep 17 00:00:00 2001 From: evlist Date: Wed, 19 Oct 2022 13:55:44 +0200 Subject: [PATCH] Adding tests for the component. --- src/components/map/Map.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 52e3c1e..ab0f240 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -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