Move peek 2D functionality to peek.js FX_fcn.cpp: always erase customMappingTable if non existent ledmap wled_server.cpp: add peek.js index.js: - add canvasPeek - change resize of canvas
38 lines
977 B
HTML
38 lines
977 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
|
<meta charset="utf-8">
|
|
<meta name="theme-color" content="#222222">
|
|
<title>WLED Live Preview</title>
|
|
<script src="peek.js"></script> <!--WLEDMM-->
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvasPeek"></canvas>
|
|
<script>
|
|
var c = document.getElementById('canvasPeek');
|
|
var throttled = false;
|
|
function setCanvas() {
|
|
c.width = window.innerWidth * 0.98; //remove scroll bars
|
|
c.height = window.innerHeight * 0.98; //remove scroll bars
|
|
}
|
|
setCanvas();
|
|
peek(c);
|
|
// window.resize event listener
|
|
window.addEventListener('resize', (e)=>{
|
|
if (!throttled) { // only run if we're not throttled
|
|
setCanvas(); // actual callback action
|
|
throttled = true; // we're throttled!
|
|
setTimeout(()=>{ // set a timeout to un-throttle
|
|
throttled = false;
|
|
}, 250);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |