You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kp...@apache.org on 2013/10/11 16:33:59 UTC
svn commit: r1531312 -
/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
Author: kpreisser
Date: Fri Oct 11 14:33:59 2013
New Revision: 1531312
URL: http://svn.apache.org/r1531312
Log:
Align the drawing style in Java2D with the one in HTML5 Canvas.
Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java?rev=1531312&r1=1531311&r2=1531312&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java Fri Oct 11 14:33:59 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org