|
@ -1,11 +1,56 @@ |
|
|
import React from "react" |
|
|
|
|
|
import { Route, Routes } from "react-router-dom" |
|
|
|
|
|
|
|
|
import React, {useEffect} from "react"; |
|
|
|
|
|
import { Route, Routes } from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
|
|
import h337 from "heatmap.js"; |
|
|
|
|
|
|
|
|
const NoPageFound = React.lazy(() => import("./pages/NoPageFound")); |
|
|
const NoPageFound = React.lazy(() => import("./pages/NoPageFound")); |
|
|
const TestPage = React.lazy(() => import("./pages/TestPage")) |
|
|
|
|
|
|
|
|
const TestPage = React.lazy(() => import("./pages/TestPage")); |
|
|
|
|
|
|
|
|
|
|
|
const mouseMode = true; |
|
|
|
|
|
|
|
|
function App() { |
|
|
function App() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
var heatmapInstance = h337.create({ |
|
|
|
|
|
container: document.body, |
|
|
|
|
|
radius: 20 |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
heatmapInstance.setDataMax(9999); |
|
|
|
|
|
|
|
|
|
|
|
var addData; |
|
|
|
|
|
|
|
|
|
|
|
if(mouseMode) { |
|
|
|
|
|
const mouseDataFunc = function(ev) { |
|
|
|
|
|
heatmapInstance.addData({ |
|
|
|
|
|
x: ev.layerX, |
|
|
|
|
|
y: ev.layerY, |
|
|
|
|
|
value: 1 |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
addData = mouseDataFunc; |
|
|
|
|
|
} else { |
|
|
|
|
|
const touchDataFunc = function(ev) { |
|
|
|
|
|
heatmapInstance.addData({ |
|
|
|
|
|
x: ev.layerX, |
|
|
|
|
|
y: ev.layerY, |
|
|
|
|
|
value: 1 |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
addData = touchDataFunc; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(mouseMode) { |
|
|
|
|
|
document.body.addEventListener("mousemove", addData, false); |
|
|
|
|
|
}else { |
|
|
|
|
|
document.body.addEventListener("touchmove", addData, false); |
|
|
|
|
|
document.body.addEventListener("touchstart", addData, false); |
|
|
|
|
|
document.body.addEventListener("touchend", addData, false); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
// TODO FIX...
|
|
|
// TODO FIX...
|
|
|
/* |
|
|
/* |
|
|
There is an weird interaction/error with the lazy loading of the routers |
|
|
There is an weird interaction/error with the lazy loading of the routers |
|
|