test drawings

master
km0 3 years ago
parent bb699eba14
commit 5480dc5884

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

@ -6,9 +6,9 @@ var bufferSize = 5;
var svgElement = document.getElementById("svg-canvas"); var svgElement = document.getElementById("svg-canvas");
svgElement.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.scrollHeight}`); svgElement.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.innerHeight}`);
svgElement.setAttribute("width", `${window.innerWidth}px`); svgElement.setAttribute("width", `${window.innerWidth}px`);
svgElement.setAttribute("height", `${window.scrollHeight}px`); svgElement.setAttribute("height", `${document.innerHeight}px`);
var rect = svgElement.getBoundingClientRect(); var rect = svgElement.getBoundingClientRect();
var path = document.createElementNS("http://www.w3.org/2000/svg", "path"); var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
@ -107,8 +107,17 @@ var updateSvgPath = function () {
}; };
const presets = document.querySelectorAll(".preset"); const presets = document.querySelectorAll(".preset");
for (const preset of presets) { for (const preset of presets) {
if (preset.dataset.path) {
let offset = preset.getBoundingClientRect();
let drawing = preset.dataset.path.split(" ");
let index = 1;
preset.addEventListener("mousemove", (e) => { preset.addEventListener("mousemove", (e) => {
console.log(preset.dataset.path); strPath += ` ${drawing[index]}`;
index += 1;
path.setAttribute("d", strPath);
}); });
} }
}

@ -23,5 +23,7 @@ svg {
width: 32ch; width: 32ch;
height: 18ch; height: 18ch;
margin: 100px; margin: 100px;
position: relative;
z-index: 100;
} }

Loading…
Cancel
Save