From c731c6a7e6bb9685dd27250900a3393e5a7f8631 Mon Sep 17 00:00:00 2001 From: evlist Date: Thu, 17 Nov 2022 23:33:57 +0100 Subject: [PATCH] Testing the onContextMenu event. --- src/components/map/Handlers.tsx | 10 +++++++++- src/lib/cache.ts | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/map/Handlers.tsx b/src/components/map/Handlers.tsx index 4fb4c7a..2d949b4 100644 --- a/src/components/map/Handlers.tsx +++ b/src/components/map/Handlers.tsx @@ -4,10 +4,11 @@ import { Point } from './types'; import './Handler.css'; import { handlersConfig } from './config'; import { Transformation } from './LiveMap'; +import cache from '../../lib/cache'; /** * - * + * * */ export interface HandlersProperties { @@ -292,6 +293,12 @@ export const Handlers: react.FC = ( } }; + const contextMenuHandler = (event: any) => { + console.log(event); + event.preventDefault(); + console.log(cache.map({ cacheId: 'points' })); + }; + return (
= ( onTouchCancel={touchCancelHandler} onTouchStart={touchStartHandler} onTouchMove={touchMoveHandler} + onContextMenu={contextMenuHandler} /> ); }; diff --git a/src/lib/cache.ts b/src/lib/cache.ts index f239234..14e3dc6 100644 --- a/src/lib/cache.ts +++ b/src/lib/cache.ts @@ -49,6 +49,13 @@ const cache = { k.delete(key); return value; }, + map: (params: any) => { + const { cacheId } = params; + if (!_allCaches.has(cacheId)) { + return null; + } + return _allCaches.get(cacheId); + }, }; export default cache;