in ark-demo/webapp/src/components/common/map/useMapHooks.js [32:70]
export function useMapHooks() {
const classes = useStyles();
const dispatch = useDispatch();
let isHovering = false;
const handleViewStateChange = ({ viewState }) => {
dispatch(setViewState(viewState));
};
const handleSizeChange = ({ width, height }) => {
dispatch(setViewState({ width, height }));
};
const handleHover = ({ object }) => (isHovering = !!object);
const handleCursor = ({ isDragging }) =>
isDragging ? 'grabbing' : isHovering ? 'pointer' : 'grab';
const handleTooltip = (info) => {
if (info?.object?.html) {
return {
html: `<div class='content'>${info.object.html}<div class='arrow'></div></div>`,
className: classes.tooltip,
style: {
padding: 0,
background: 'none',
},
};
}
};
return {
handleViewStateChange,
handleSizeChange,
handleHover,
handleCursor,
handleTooltip,
};
}