Testing the onContextMenu event.

This commit is contained in:
Eric van der Vlist 2022-11-17 23:33:57 +01:00
parent 8906bed1e7
commit c731c6a7e6
2 changed files with 16 additions and 1 deletions

View File

@ -4,10 +4,11 @@ import { Point } from './types';
import './Handler.css'; import './Handler.css';
import { handlersConfig } from './config'; import { handlersConfig } from './config';
import { Transformation } from './LiveMap'; import { Transformation } from './LiveMap';
import cache from '../../lib/cache';
/** /**
* *
* *
* *
*/ */
export interface HandlersProperties { export interface HandlersProperties {
@ -292,6 +293,12 @@ export const Handlers: react.FC<HandlersProperties> = (
} }
}; };
const contextMenuHandler = (event: any) => {
console.log(event);
event.preventDefault();
console.log(cache.map({ cacheId: 'points' }));
};
return ( return (
<div <div
className='handler' className='handler'
@ -306,6 +313,7 @@ export const Handlers: react.FC<HandlersProperties> = (
onTouchCancel={touchCancelHandler} onTouchCancel={touchCancelHandler}
onTouchStart={touchStartHandler} onTouchStart={touchStartHandler}
onTouchMove={touchMoveHandler} onTouchMove={touchMoveHandler}
onContextMenu={contextMenuHandler}
/> />
); );
}; };

View File

@ -49,6 +49,13 @@ const cache = {
k.delete(key); k.delete(key);
return value; return value;
}, },
map: (params: any) => {
const { cacheId } = params;
if (!_allCaches.has(cacheId)) {
return null;
}
return _allCaches.get(cacheId);
},
}; };
export default cache; export default cache;