[OpenLayers-Commits] r10844 - sandbox/bjornharrtell/swipe/lib/OpenLayers/Control

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Sun Oct 17 14:10:28 EDT 2010


Author: bjornharrtell
Date: 2010-10-17 11:10:28 -0700 (Sun, 17 Oct 2010)
New Revision: 10844

Modified:
   sandbox/bjornharrtell/swipe/lib/OpenLayers/Control/Swipe.js
Log:
Commented source

Modified: sandbox/bjornharrtell/swipe/lib/OpenLayers/Control/Swipe.js
===================================================================
--- sandbox/bjornharrtell/swipe/lib/OpenLayers/Control/Swipe.js	2010-10-16 21:58:49 UTC (rev 10843)
+++ sandbox/bjornharrtell/swipe/lib/OpenLayers/Control/Swipe.js	2010-10-17 18:10:28 UTC (rev 10844)
@@ -4,26 +4,39 @@
 
 /**
  * Class: OpenLayers.Control.Swipe
+ * The Swipe control will reveal/hide a target layer right/left side of mouse mouse position on the map.
  * 
  * Inherits from: - <OpenLayers.Control>
  */
 OpenLayers.Control.Swipe = OpenLayers.Class(OpenLayers.Control, {
-    map : null,
+    
+    /**
+     * Property: layer
+     * {<OpenLayers.Layer>} The target layer to be swiped
+     */
     layer : null,
+    
+    /**
+     * Property: layerContainerDiv
+     * {DOMElement} Layer container div used to read panning offset
+     */
     layerContainerDiv : null,
-    div : null,
-
+    
     /**
-     * Property: type {OpenLayers.Control.TYPES}
+     * Property: div
+     * {DOMElement} Layer div for CSS clip manipulation
      */
-    type : OpenLayers.Control.TYPE_TOOL,
+    div : null,
 
     /**
      * Constructor: OpenLayers.Control.Swipe
      * 
-     * Parameters: layer - {OpenLayers.Layer} options - {Object} An optional object whose properties will be used to extend the control.
+     * Parameters:
+     * layer - {OpenLayers.Layer} Target layer for the swipe effect.
+     * options - {Object} An optional object whose properties will be used to extend the control.
      */
     initialize : function(layer, options) {
+        // setup properties to be used for swipe logic
         this.map = layer.map;
         this.layer = layer;
         this.div = this.layer.div;
@@ -32,8 +45,13 @@
         OpenLayers.Control.prototype.initialize.apply(this, [ options ]);
     },
 
+    /**
+     * APIMethod: activate
+     * Activate the control.
+     */
     activate : function() {
         var activated = OpenLayers.Control.prototype.activate.call(this);
+        
         if (activated) {
             this.map.events.on({
                 mousemove : this.onMousemove,
@@ -42,6 +60,10 @@
         }
     },
 
+    /**
+     * APIMethod: deactivate
+     * Deactivate the control.
+     */
     deactivate : function() {
         var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
 
@@ -55,6 +77,14 @@
         }
     },
 
+    /**
+     * Method: onMousemove
+     * Registered as a listener for mousemove events on the map. Calculates clip region
+     * that will create the swipe effect.
+     *
+     * Parameters:
+     * e - {Object} The mousemove event.
+     */
     onMousemove : function(e) {
         var offsetX = (e.clientX - this.map.div.offsetLeft) - this.layerContainerDiv.offsetLeft;
         var offsetY = -this.layerContainerDiv.offsetTop;



More information about the Commits mailing list