Long story short. I have the following layout. I want to be able to drag and drop and image into a drag-area and then draw it into the canvas. The canvas shall be of fixed size (let’s say 400×400) and I want to resize the image in order to perfectly fit the canvas, no matter what the initial picture was. For this purpose I’ve written the following javascript code:

The problem is, when dragged, the image doesn’t fit the canvas. How can I correct the code?

Post image

Layout:

Post image



Source link

Write A Comment