DEV Community

Cover image for Build a Web Paint Application

Build a Web Paint Application

Anshika on September 07, 2022

How exciting is it to build something you grew up using? I'm pretty sure that most of you have used Microsoft Paint. Didn't we all feel like Picas...
Collapse
 
michaeltharrington profile image
Michael Tharrington •

This is super cool! Nicely done. 🙌

If you're going to continue the trend of rebuilding old MS tech for the web, I'd like to suggest bringing back Clippy as a browser extension, haha! 😀

Clippy, aka Microsoft's Office Assistant, raising eyebrows and wiggling around

Collapse
 
anshika_gautam_ profile image
Anshika •

Sure, I'll give it a try.

Collapse
 
michaeltharrington profile image
Michael Tharrington •

Oh what?! That would be so cool. 🙌

Maybe it could give writing advice in the DEV editor, haha! Almost like a Grammarly. Or if ya wanted to make it a joke, it could give out bad writing advice, lol.

If you do make a Clippy clone for the browser, whichever direction you take it, I'd be so siked to read about it! 😀

Collapse
 
anuragprasoon profile image
Anurag Prasoon •

Nice Blog , Anshika

Collapse
 
thomasbnt profile image
Thomas Bonnet •

Oww so cool ! 🤩

Collapse
 
acoder123 profile image
acoder •

It took you a lot of time to create this, thanks.

Collapse
 
decker67 profile image
decker •

Nice one, thank you.

Collapse
 
muhyilmaz profile image
MUHAMMED YILMAZ •

easy tutorial. Thanks :)

Collapse
 
coditdoc profile image
Codeitdoc7 • • Edited

Now its time to wake up the artist in my friend 😄.

Thanks @anshika_gautam_ its a great article.

Collapse
 
anshika_gautam_ profile image
Anshika •

Haha! Definitely!

Collapse
 
cicirello profile image
Vincent A. Cicirello •

Fun little web application. Very nice.

Collapse
 
naucode profile image
Al - Naucode •

Really cool project, good job!

Collapse
 
developerbishwas profile image
Bishwas Bhandari •

Looks cool, thanks for sharing.

Collapse
 
anshika_gautam_ profile image
Anshika •

What should I write about next?

Collapse
 
coditdoc profile image
Codeitdoc7 •

How to wake up writer in your friend 😸

Collapse
 
tatrakrad profile image
tatra • • Edited

For the curious, everything works as copy pasted except for mouse cursor position

// initialize position as 0,0
var pos = { x: 0, y: 0 };

// new position from mouse events
function setPosition(e) {
  pos.x = parseInt(e.clientX - offsetX);
  pos.y = parseInt(e.clientY - offsetY);
}
Enter fullscreen mode Exit fullscreen mode

or adding event listeners to the document (not window)

document.addEventListener("mousemove", draw);
document.addEventListener("mousedown", setPosition);
document.addEventListener("mouseenter", setPosition);
document.getElementById("color-picker").addEventListener("change", colorPick);
setColor();
Enter fullscreen mode Exit fullscreen mode
Collapse
 
anshika_gautam_ profile image
Anshika •

Mouse cursor position has to be manipulated according to your preference and viewport size. You can change the x and y position as per your convenience. And I didn't understand what is not working for you in event listeners. Can you elaborate?

Collapse
 
tatrakrad profile image
tatra • • Edited

im just helpfully posting snippets that make the rest of this code work. It's your code by the way, from your finished version

Collapse
 
tatrakrad profile image
tatra •

doesn't work, draw never gets called

Collapse
 
anshika_gautam_ profile image
Anshika •

Hey, maybe you skipped calling the function.

Collapse
 
anshika_gautam_ profile image
Anshika •

Great! Thank You for suggestions.

Collapse
 
karna98 profile image
Vedant Wakalkar •

Just a suggestion, if the project is deploy-able, then deploy it. People can actually use it and give feedback for the same.

As this is JavaScript Project you can deploy it using GitHub Pages too.

Collapse
 
anshika_gautam_ profile image
Anshika •

Hey! :D Project is already deployed and live link is provided in the tutorial itself.

Collapse
 
karna98 profile image
Vedant Wakalkar •

Yup found it in the post but missing from GitHub Repository description (That's where I usually look at).

Collapse
 
jillbatey profile image
JillBatey •

How can I build Application in Canvas ? دعاء لارجاع الزوج

Collapse
 
anshika_gautam_ profile image
Anshika •

Can you elaborate? What application do you mean?

Collapse
 
benhuteele profile image
BenHuteele • • Edited

Wow that's so Interesting Really Appreciated I will defiantly try it inside my Custom Lithium Ion Battery Pack Manufacturer website.