[OpenLayers-Commits] r11945 - sandbox/tschaub/editing/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue May 3 12:59:59 EDT 2011


Author: tschaub
Date: 2011-05-03 09:59:58 -0700 (Tue, 03 May 2011)
New Revision: 11945

Modified:
   sandbox/tschaub/editing/examples/point-grid.html
   sandbox/tschaub/editing/examples/point-grid.js
Log:
Demonstrating that dx and dy can be set independently.

Modified: sandbox/tschaub/editing/examples/point-grid.html
===================================================================
--- sandbox/tschaub/editing/examples/point-grid.html	2011-05-03 16:24:21 UTC (rev 11944)
+++ sandbox/tschaub/editing/examples/point-grid.html	2011-05-03 16:59:58 UTC (rev 11945)
@@ -37,12 +37,19 @@
 
      
     Grid spacing:
-    <select name="spacing" id="spacing">
+    <select name="dx" id="dx">
         <option value="10">10</option>
         <option value="15">15</option>
         <option value="20">20</option>
         <option value="25">25</option>
         <option value="30">30</option>
+    </select> x
+    <select name="dy" id="dy">
+        <option value="10">10</option>
+        <option value="15">15</option>
+        <option value="20">20</option>
+        <option value="25">25</option>
+        <option value="30">30</option>
     </select>
 
     &nbsp;

Modified: sandbox/tschaub/editing/examples/point-grid.js
===================================================================
--- sandbox/tschaub/editing/examples/point-grid.js	2011-05-03 16:24:21 UTC (rev 11944)
+++ sandbox/tschaub/editing/examples/point-grid.js	2011-05-03 16:59:58 UTC (rev 11945)
@@ -1,12 +1,12 @@
 var points = new OpenLayers.Layer.PointGrid({
-    isBaseLayer: true, dx: 20, dy: 20
+    isBaseLayer: true, dx: 15, dy: 15
 });
 
 var map = new OpenLayers.Map({
     div: "map",
     layers: [points],
     center: new OpenLayers.LonLat(0, 0),
-    zoom: 1
+    zoom: 2
 });
 
 var rotation = document.getElementById("rotation");
@@ -15,11 +15,16 @@
     points.setRotation(Number(rotation.value));
 }
 
-var spacing = document.getElementById("spacing");
-spacing.value = String(points.dx);
-spacing.onchange = function() {
-    points.setSpacing(Number(spacing.value));
+var dx = document.getElementById("dx");
+var dy = document.getElementById("dy");
+dx.value = String(points.dx);
+dy.value = String(points.dy);
+dx.onchange = function() {
+    points.setSpacing(Number(dx.value), Number(dy.value));
 }
+dy.onchange = function() {
+    points.setSpacing(Number(dx.value), Number(dy.value));
+}
 
 var max = document.getElementById("max");
 max.value = String(points.maxFeatures);



More information about the Commits mailing list