mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
touch
This commit is contained in:
parent
10fd719902
commit
41bd0591e3
@ -20,7 +20,7 @@ internal class Program
|
|||||||
// Add your object to the store
|
// Add your object to the store
|
||||||
var service = await Warehouse.Put("sys/demo", new Demo());
|
var service = await Warehouse.Put("sys/demo", new Demo());
|
||||||
|
|
||||||
var http = await Warehouse.Put<HTTPServer>("sys/http", new HTTPServer() { Port = 8080 });
|
var http = await Warehouse.Put<HTTPServer>("sys/http", new HTTPServer() { Port = 8888 });
|
||||||
|
|
||||||
|
|
||||||
http.MapGet("{url}", (string url, HTTPConnection sender) =>
|
http.MapGet("{url}", (string url, HTTPConnection sender) =>
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
html {
|
html {
|
||||||
font-family: def;
|
font-family: def;
|
||||||
}
|
}
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
i-router {
|
i-router {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
@ -31,7 +34,7 @@ i-app {
|
|||||||
color: #000000;
|
color: #000000;
|
||||||
background: #e3e3e3;
|
background: #e3e3e3;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
width: 500px;
|
width: calc(100% - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
|
@ -49,12 +49,21 @@ async function init() {
|
|||||||
colorId = document.querySelector('input[name="color"]:checked').value;
|
colorId = document.querySelector('input[name="color"]:checked').value;
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
canvas.addEventListener("touchstart", (e) => {
|
||||||
|
drawing = true;
|
||||||
|
colorId = document.querySelector('input[name="color"]:checked').value;
|
||||||
|
});
|
||||||
|
|
||||||
canvas.addEventListener("mouseup", function (e) {
|
canvas.addEventListener("mouseup", function (e) {
|
||||||
drawing = false;
|
drawing = false;
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
canvas.addEventListener("touchend", function (e) {
|
||||||
|
drawing = false;
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
|
||||||
canvas.addEventListener("mousemove", function (e) {
|
canvas.addEventListener("mousemove", function (e) {
|
||||||
//console.log(e);
|
|
||||||
|
|
||||||
var rect = canvas.getBoundingClientRect();
|
var rect = canvas.getBoundingClientRect();
|
||||||
|
|
||||||
@ -68,10 +77,27 @@ async function init() {
|
|||||||
ctx.arc(x, y, 4, 0, 2 * Math.PI);
|
ctx.arc(x, y, 4, 0, 2 * Math.PI);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
demo.Draw(x / 4, y / 4, colorId);
|
demo.Draw(x / 4, y / 4, colorId);
|
||||||
//ctx.fillRect(x, y, 10, 10);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
canvas.addEventListener("touchmove", function (e) {
|
||||||
|
|
||||||
|
var rect = canvas.getBoundingClientRect();
|
||||||
|
|
||||||
|
let x = e.touches[0].clientX - rect.left;
|
||||||
|
let y = e.touches[0].clientY - rect.top;
|
||||||
|
|
||||||
|
if (drawing) {
|
||||||
|
ctx.fillStyle = colors[colorId];
|
||||||
|
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(x, y, 4, 0, 2 * Math.PI);
|
||||||
|
ctx.fill();
|
||||||
|
demo.Draw(x / 4, y / 4, colorId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
demo.on("Drawn", (pt) => {
|
demo.on("Drawn", (pt) => {
|
||||||
ctx.fillStyle = colors[pt.Color];
|
ctx.fillStyle = colors[pt.Color];
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user