Author: kpreisser Date: Fri Oct 11 14:36:54 2013 New Revision: 1531314 URL: http://svn.apache.org/r1531314 Log: Align the drawing style in Java2D with the one in HTML5 Canvas.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1531312 Modified: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java?rev=1531314&r1=1531313&r2=1531314&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java (original) +++ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java Fri Oct 11 14:36:54 2013 @@ -153,7 +153,13 @@ public final class DrawMessage { g.setColor(new Color(colorR & 0xFF, colorG & 0xFF, colorB & 0xFF, colorA & 0xFF)); - if (type == 1 || type == 2) { + if (x1 == x2 && y1 == y2) { + // Always draw as arc to meet the behavior in the HTML5 Canvas. + Arc2D arc = new Arc2D.Double(x1, y1, 0, 0, + 0d, 360d, Arc2D.OPEN); + g.draw(arc); + + } else if (type == 1 || type == 2) { // Draw a line. Line2D line = new Line2D.Double(x1, y1, x2, y2); g.draw(line); @@ -170,6 +176,8 @@ public final class DrawMessage { y2 = this.y1; } + // TODO: If (x1 == x2 || y1 == y2) draw as line. + if (type == 3) { // Draw a rectangle. Rectangle2D rect = new Rectangle2D.Double(x1, y1, @@ -179,7 +187,7 @@ public final class DrawMessage { } else if (type == 4) { // Draw an ellipse. Arc2D arc = new Arc2D.Double(x1, y1, x2 - x1, y2 - y1, - 0d, 360d, Arc2D.CHORD); + 0d, 360d, Arc2D.OPEN); g.draw(arc); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org