const canvas = document.getElementById('canvas') const ctx = canvas.getContext('2d') const width = canvas.width; const height = canvas.height; let current; let selection = [] const tools = { graffity: { mousemove(e){ //e.buttons 0b00000x11 & 0b00000100 == x (e.buttons & 0b001) && new Circle(e.layerX, e.layerY, +size.value, color.value) } }, circle: { mousedown(e){ current = new Circle(e.layerX,e.layerY, 1, color.value) }, mousemove(e){ if (!current) return; current.radius = current.distanceTo(e.layerX, e.layerY) Drawable.drawAll() }, mouseup(e){ current = null } }, line: { //ctrl-c ctrl-v в rectangle. Так же добавьте его в mousedown(e){ current = new Rectangle(e.layerX, e.layerY, 0, 0, color.value, +size.value) }, mousemove(e){ if (!current) return; current.width = e.layerX - current.x current.height = e.layerY - current.y Drawable.drawAll() }, mouseup(e){ current = null } }, ellipse: { //ctrl-c ctrl-v в rectangle. Так же добавьте его в