From b3a8f60f1e121f2609aa134e665b072b939f466e Mon Sep 17 00:00:00 2001 From: evlist Date: Wed, 19 Oct 2022 13:04:56 +0200 Subject: [PATCH] Doc --- src/components/map/Handlers.tsx | 12 +++++++++--- src/components/map/Map.tsx | 9 +++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/map/Handlers.tsx b/src/components/map/Handlers.tsx index 76c725d..8a84441 100644 --- a/src/components/map/Handlers.tsx +++ b/src/components/map/Handlers.tsx @@ -1,11 +1,16 @@ -import react, { useRef, useState } from 'react'; -import { atom, useAtom } from 'jotai'; +import react, { useRef } from 'react'; +import { useAtom } from 'jotai'; import { Point } from './types'; import './Handler.css'; import { handlersConfig } from './config'; -import { Transformation, relativeCoordinateSystemAtom } from './Map'; +import { relativeCoordinateSystemAtom } from './Map'; +/** + * + * See also {@link components/map/Map!relativeCoordinateSystemAtom}. + * + */ export interface HandlersProperties {} /** * @@ -18,6 +23,7 @@ export interface HandlersProperties {} * * touchStart, touchEnd and touchCancel to track touch state * * touchMove to shift the map (single finger) or shift and zoom (two fingers). * + * Communication with the parent `` is done through {@link components/map/Map!relativeCoordinateSystemAtom}. */ export const Handlers: react.FC = ( props: HandlersProperties diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 4951dff..52e3c1e 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -15,12 +15,21 @@ const initialCoordinateSystem = { const coordinateSystemAtom = atom(initialCoordinateSystem); +/** + * Description of coordinates system transformation + */ export interface Transformation { + /** New translation to apply */ deltaShift: Point | null; + /** Zoom factor to apply */ deltaZoom: number | null; + /** Center of the new zoom to apply */ zoomCenter: Point | null; } +/** + * A write only atom to translate and zoom the coordinate system + */ export const relativeCoordinateSystemAtom = atom( null, (get, set, t: Transformation) => {