Drawing Board: Submitted in Fulfillment of The Requirements of Micro-Project Client Side Scripting Language
Drawing Board: Submitted in Fulfillment of The Requirements of Micro-Project Client Side Scripting Language
SUBJECT INCHARGE
Mrs. Kirti Tamboli
“Drawing Board”
is done by
“Siddhesh Shinde and Tejas Jadhav”
“Drawing Board”
is submitted
For
the diploma in Information Technology to the
_________________________ ________________________
Aim
To make a Drawing Board using HTML CSS & JavaScript.
Course Outcomes
1. Create interactive web pages using program flow control structure.
2. Create event based web forms using JavaScript.
Action Plan
Sr. No. Detail of activity Plan Start Date Plan Finish Date
Team Member
Name Roll no
Siddhesh Shinde 07
Tejas Jadhav 08
Subject In-charge
Mrs. Kirti Tamboli
Drawing Board
Rationale
JavaScript is limited featured client side programming language. JavaScript runs at the client
end through the user's browser without sending messages back and forth to the server. It is
widely used by the web developers to do things such as build dynamic web pages, respond
to events, create interactive forms, validate data that the visitor enters into a form, control the
browser etc. This course helps student to create highly interactive web pages using these
features.
Aim
To make a Drawing Board using HTML CSS & JavaScript.
Course Outcomes
1. Create interactive web pages using program flow control structure.
2. Create event based web forms using JavaScript.
Literature
A drawing board (also drawing table, drafting table or architect's table) is, in its antique form, a
kind of multipurpose desk which can be used for any kind of drawing, writing or impromptu
sketching on a large sheet of paper or for reading a large format book or other oversized document
or for drafting precise technical illustrations (such as engineering drawings or architectural
drawings). The drawing table used to be a frequent companion to a pedestal desk in a study or
private library, during the pre-industrial and early industrial era.
Actual Methodology Followed
Resources Required
<head>
<meta charset="utf-8">
</head>
<body>
<div class="container">
<section class="tools-board">
<div class="row">
<label class="title">Shapes</label>
<ul class="options">
<span>Rectangle</span>
</li>
<span>Circle</span>
</li>
<span>Triangle</span>
</li>
<li class="option">
</li>
</ul>
</div>
<div class="row">
<label class="title">Options</label>
<ul class="options">
<span>Brush</span>
</li>
<span>Eraser</span>
</li>
<li class="option">
</li>
</ul>
</div>
<label class="title">Colors</label>
<ul class="options">
<li class="option"></li>
<li class="option"></li>
<li class="option"></li>
<li class="option">
</li>
</ul>
</div>
</div>
</section>
<section class="drawing-board">
<canvas></canvas>
</section>
</div>
</body>
</html>
CSS:-
window.addEventListener("load", () => {
// setting canvas width/height.. offsetwidth/height returns viewable width/height of an element
canvas.width = canvas.offsetWidth;
canvas.height = canvas.offsetHeight;
setCanvasBackground();
});
toolBtns.forEach(btn => {
btn.addEventListener("click", () => { // adding click event to all tool option
// removing active class from the previous option and adding on current clicked option
document.querySelector(".options .active").classList.remove("active");
btn.classList.add("active");
selectedTool = btn.id;
});
});
colorBtns.forEach(btn => {
btn.addEventListener("click", () => { // adding click event to all color button
// removing selected class from the previous option and adding on current clicked option
document.querySelector(".options .selected").classList.remove("selected");
btn.classList.add("selected");
// passing selected btn background color as selectedColor value
selectedColor = window.getComputedStyle(btn).getPropertyValue("background-color");
});
});
colorPicker.addEventListener("change", () => {
// passing picked color value from color picker to last color btn background
colorPicker.parentElement.style.background = colorPicker.value;
colorPicker.parentElement.click();
});
clearCanvas.addEventListener("click", () => {
ctx.clearRect(0, 0, canvas.width, canvas.height); // clearing whole canvas
setCanvasBackground();
});
saveImg.addEventListener("click", () => {
const link = document.createElement("a"); // creating <a> element
link.download = `${Date.now()}.jpg`; // passing current date as link download value
link.href = canvas.toDataURL(); // passing canvasData as link href value
link.click(); // clicking link to download image
});
canvas.addEventListener("mousedown", startDraw);
canvas.addEventListener("mousemove", drawing);
canvas.addEventListener("mouseup", () => isDrawing = false);
Output :-
Skill Developed
We learned how to create a Drawing Board using JavaScript.
Application
Drawing boards are scaled plastic boards designed specifically for technical drawing. They are
used to draw parallel lines easily and precisely, e.g. for three-dimensional projections and much
more. They feature a mechanical device with rail-mounted rulers that run horizontally and
vertically at an exact 90° angle.
Subject In-charge
Mrs. Kirti Tamboli