Skip to content

Commit

Permalink
graph a bit more mobile friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeloChecked committed Oct 5, 2024
1 parent 6fa88ac commit 60670b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blog/scripts/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function createSvg(
body,
) {
const svg = `
<svg id="${id}" viewBox="-${innerWidth / 2} -${innerHeight / 2} ${innerWidth} ${innerHeight}" width="${width}" height="${height}" style="background-color: ${bgColor};">
<svg id="${id}" viewBox="-${innerWidth / 2} -${innerHeight / 2} ${innerWidth} ${innerHeight}" width="${width}" height="${height}" style="background-color: ${bgColor}; width: 100%; max-width:${width}px;">
${body}
</svg>
`;
Expand Down Expand Up @@ -353,6 +353,7 @@ node${node.id}.addEventListener("mouseleave", (event) => {
graphSvg.addEventListener("wheel", onWheel)
const onMouseMove = (event) => {
event.preventDefault()
console.log(event)
if (event.buttons === 0) {
return;
}
Expand All @@ -366,6 +367,7 @@ node${node.id}.addEventListener("mouseleave", (event) => {
}
}
graphSvg.addEventListener("mousemove", onMouseMove)
`;

return script;
Expand Down

0 comments on commit 60670b1

Please sign in to comment.