ExpressHermes / Primitive-Paint

A paint web app using paperjs library
https://expresshermes.github.io/Primitive-Paint/
MIT License
8 stars 18 forks source link

Toggle to Filled Shapes #16

Closed agrajagrawal closed 3 years ago

agrajagrawal commented 3 years ago

I have added a checkbox to fill shapes with brush's color

agrajagrawal commented 3 years ago

@ExpressHermes https://agrajagrawal.github.io/Primitive-Paint/rectangle.html

agrajagrawal commented 3 years ago

@ExpressHermes We won't be needing a function to remove duplicate code as if we remove duplicated code from mouseDrag function it will work fine as variables are defined globally and before mouseDrag the mouseDown will necessarily be called which initializes variable. And On the other hand, I have done some formatting manually and also used VS code extension prettier code formatter! It looks pretty clean now :)

ExpressHermes commented 3 years ago

Almost all the code inside the onMouseDown and onMouseDrag is duplicated. Putting it into a function and calling that function as a callback will increase the readability of the whole code. The global variables will remain global.

agrajagrawal commented 3 years ago

Almost all the code inside the onMouseDown and onMouseDrag is duplicated. Putting it into a function and calling that function as a callback will increase the readability of the whole code. The global variables will remain global.

Okay I will be working on it by tomorrow 😁

agrajagrawal commented 3 years ago

@ExpressHermes I have removed the toggle-to-fill feature as I thought of something more innovation Now we have two color inputs border color and fill color Fill color is set to default as canvas color!! i.e "#EEEEEE" Different colors make it look cooler :) https://agrajagrawal.github.io/Primitive-Paint/circle.html

image