Doc
This commit is contained in:
parent
acbefa983d
commit
b3a8f60f1e
|
@ -1,11 +1,16 @@
|
||||||
import react, { useRef, useState } from 'react';
|
import react, { useRef } from 'react';
|
||||||
import { atom, useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
|
|
||||||
import { Point } from './types';
|
import { Point } from './types';
|
||||||
import './Handler.css';
|
import './Handler.css';
|
||||||
import { handlersConfig } from './config';
|
import { handlersConfig } from './config';
|
||||||
import { Transformation, relativeCoordinateSystemAtom } from './Map';
|
import { relativeCoordinateSystemAtom } from './Map';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* See also {@link components/map/Map!relativeCoordinateSystemAtom}.
|
||||||
|
*
|
||||||
|
*/
|
||||||
export interface HandlersProperties {}
|
export interface HandlersProperties {}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -18,6 +23,7 @@ export interface HandlersProperties {}
|
||||||
* * touchStart, touchEnd and touchCancel to track touch state
|
* * touchStart, touchEnd and touchCancel to track touch state
|
||||||
* * touchMove to shift the map (single finger) or shift and zoom (two fingers).
|
* * touchMove to shift the map (single finger) or shift and zoom (two fingers).
|
||||||
*
|
*
|
||||||
|
* Communication with the parent `<Map>` is done through {@link components/map/Map!relativeCoordinateSystemAtom}.
|
||||||
*/
|
*/
|
||||||
export const Handlers: react.FC<HandlersProperties> = (
|
export const Handlers: react.FC<HandlersProperties> = (
|
||||||
props: HandlersProperties
|
props: HandlersProperties
|
||||||
|
|
|
@ -15,12 +15,21 @@ const initialCoordinateSystem = {
|
||||||
|
|
||||||
const coordinateSystemAtom = atom(initialCoordinateSystem);
|
const coordinateSystemAtom = atom(initialCoordinateSystem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of coordinates system transformation
|
||||||
|
*/
|
||||||
export interface Transformation {
|
export interface Transformation {
|
||||||
|
/** New translation to apply */
|
||||||
deltaShift: Point | null;
|
deltaShift: Point | null;
|
||||||
|
/** Zoom factor to apply */
|
||||||
deltaZoom: number | null;
|
deltaZoom: number | null;
|
||||||
|
/** Center of the new zoom to apply */
|
||||||
zoomCenter: Point | null;
|
zoomCenter: Point | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A write only atom to translate and zoom the coordinate system
|
||||||
|
*/
|
||||||
export const relativeCoordinateSystemAtom = atom(
|
export const relativeCoordinateSystemAtom = atom(
|
||||||
null,
|
null,
|
||||||
(get, set, t: Transformation) => {
|
(get, set, t: Transformation) => {
|
||||||
|
|
Loading…
Reference in New Issue