devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wk...@apache.org
Subject svn commit: r1749222 - /devicemap/trunk/examples/1.0/java/gwtcanvas/src/org/apache/devicemap/gwt/gwtcanvasdemo/client/DmapGwtCanvas.java
Date Sun, 19 Jun 2016 22:32:56 GMT
Author: wkeil
Date: Sun Jun 19 22:32:56 2016
New Revision: 1749222

URL: http://svn.apache.org/viewvc?rev=1749222&view=rev
Log:
DMAP-153: Add a demo for HTML5 Canvas 

Task-Url: https://issues.apache.org/jira/browse/DMAP-153

Modified:
    devicemap/trunk/examples/1.0/java/gwtcanvas/src/org/apache/devicemap/gwt/gwtcanvasdemo/client/DmapGwtCanvas.java

Modified: devicemap/trunk/examples/1.0/java/gwtcanvas/src/org/apache/devicemap/gwt/gwtcanvasdemo/client/DmapGwtCanvas.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/examples/1.0/java/gwtcanvas/src/org/apache/devicemap/gwt/gwtcanvasdemo/client/DmapGwtCanvas.java?rev=1749222&r1=1749221&r2=1749222&view=diff
==============================================================================
--- devicemap/trunk/examples/1.0/java/gwtcanvas/src/org/apache/devicemap/gwt/gwtcanvasdemo/client/DmapGwtCanvas.java
(original)
+++ devicemap/trunk/examples/1.0/java/gwtcanvas/src/org/apache/devicemap/gwt/gwtcanvasdemo/client/DmapGwtCanvas.java
Sun Jun 19 22:32:56 2016
@@ -36,35 +36,38 @@ import com.google.gwt.user.client.ui.Lab
 import com.google.gwt.user.client.ui.RootPanel;
 
 public class DmapGwtCanvas implements EntryPoint {
-  static final String holderId = "canvasholder";
+  static final String HOLDER_ID = "canvasholder";
+  static final String UPGRADE_MESSAGE = "Your browser does not support the HTML5 Canvas.
Please upgrade your browser to view this demo.";
 
-  static final String upgradeMessage = "Your browser does not support the HTML5 Canvas. Please
upgrade your browser to view this demo.";
-
-  Canvas canvas;
-  Canvas backBuffer;
-  LogoGroup logoGroup;
-  BallGroup ballGroup;
-  Lens lens;
+  private Canvas canvas;
+  private Canvas backBuffer;
+  private LogoGroup logoGroup;
+  private BallGroup ballGroup;
+  private Lens lens;
   
   // mouse positions relative to canvas
-  int mouseX, mouseY;
+  private int mouseX;
+  private int mouseY;
 
   //timer refresh rate, in milliseconds
-  static final int refreshRate = 25;
+  static final int REFRESH_RATE = 25;
   
   // canvas size, in px
-  static final int height = 400;
-  static final int width = 400;
+  private int height = 300;
+  private int width = 300;
   
   final CssColor redrawColor = CssColor.make("rgba(255,255,255,0.6)");
   Context2d context;
   Context2d backBufferContext;
   
   public void onModuleLoad() {
+    height = 300;
+    width = 300;
+      
     canvas = Canvas.createIfSupported();
     backBuffer = Canvas.createIfSupported();
     if (canvas == null) {
-      RootPanel.get(holderId).add(new Label(upgradeMessage));
+      RootPanel.get(HOLDER_ID).add(new Label(UPGRADE_MESSAGE));
       return;
     }
 
@@ -75,7 +78,7 @@ public class DmapGwtCanvas implements En
     canvas.setCoordinateSpaceHeight(height);
     backBuffer.setCoordinateSpaceWidth(width);
     backBuffer.setCoordinateSpaceHeight(height);
-    RootPanel.get(holderId).add(canvas);
+    RootPanel.get(HOLDER_ID).add(canvas);
     context = canvas.getContext2d();
     backBufferContext = backBuffer.getContext2d();
     
@@ -94,7 +97,7 @@ public class DmapGwtCanvas implements En
         doUpdate();
       }
     };
-    timer.scheduleRepeating(refreshRate);
+    timer.scheduleRepeating(REFRESH_RATE);
   }
 
   void doUpdate() {



Mime
View raw message