mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Finished empty rectangle tool
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//draw a line between two points on canvas
|
||||
function line(x0,y0,x1,y1) {
|
||||
function line(x0,y0,x1,y1, brushSize) {
|
||||
|
||||
var dx = Math.abs(x1-x0);
|
||||
var dy = Math.abs(y1-y0);
|
||||
@@ -10,7 +10,7 @@ function line(x0,y0,x1,y1) {
|
||||
while (true) {
|
||||
//set pixel
|
||||
// If the current tool is the brush
|
||||
if (currentTool == 'pencil') {
|
||||
if (currentTool == 'pencil' || currentTool == 'rectangle') {
|
||||
// I fill the rect
|
||||
currentLayer.context.fillRect(x0-Math.floor(brushSize/2), y0-Math.floor(brushSize/2), brushSize, brushSize);
|
||||
} else if (currentTool == 'eraser') {
|
||||
|
||||
Reference in New Issue
Block a user