Hello Fine Campers!
I wonder if someone would like to tell me why my function behaves badly when called from within a function?
In the pen below, I have written a function that draws a square on a canvas. The function sets the canvas size 10 percent larger than the square.
https://codepen.io/Fishbite/pen/NZMzeR?editors=1111
If you call the function by itself square(100)
it works fine and as expected.
If you set variable ‘a’ to a numeric value and then call the function ‘square(a)’
it works fine and as expected!
However, if you call the function square(a)
from within a function that uses a text box input value assigned to variable ‘a’ things go a little awry and the bottom and right hands side of the drawn square are chopped off.
Does anyone have any clues as to what is going on here?
Help would be much appreciated. It’s driving me potty!
Thanks in advance.
LoonyToon