0

I want to get the coordinates of the four corners of a rectangle which is drawn by the user using canvas.

When the user click on the "submit coordinates" button , the variables x,y,h(height) and w(width) values should be passed to the Servlet to do some calculationsn so to get the coordinates.

Below are my my variables that stored inside the javascript:

var x = Math.min(ev._x,  tool.x0),
    y = Math.min(ev._y,  tool.y0),
    w = Math.abs(ev._x - tool.x0),
    h = Math.abs(ev._y - tool.y0); 

Now , I want to pass all the variables to my servlet where I want to do some calculations to get the coordinates of 4 corners:

top-left corner : (x , y)
top-right corner: (x+w , y)
bottom-left corner: (x , y+h)
bottom-right corner: (x+w , y+h)

What can I do in order to get all the coordinates values ? Thanks.

linnndaaa
  • 67
  • 1
  • 2
  • 9
  • This is something that you have to handle in client side. Basically in Javascript. http://stackoverflow.com/q/10445410/4506140 – Jude Niroshan Jul 29 '15 at 10:58
  • If you don't want page refresh then go for ajax else you may simply set those values in hidden field and submit the form. –  Jul 30 '15 at 01:16

0 Answers0