[Mapbender-commits] r8956 - in trunk/mapbender/http: plugins widgets

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jul 1 05:30:11 PDT 2014


Author: hwbllmnn
Date: 2014-07-01 05:30:11 -0700 (Tue, 01 Jul 2014)
New Revision: 8956

Modified:
   trunk/mapbender/http/plugins/mb_digitize_widget.php
   trunk/mapbender/http/widgets/w_digitize.js
Log:
fixed unbind bug after activating the digitizer


Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-07-01 09:54:28 UTC (rev 8955)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-07-01 12:30:11 UTC (rev 8956)
@@ -164,6 +164,13 @@
                      + '</form>'
                      + '</div>';
 
+    var selectionDialog = '<div id="selection-dialog" title="Selected features">'
+                          + '<ul id="selected-features-list">'
+                          + '</ul>'
+                          + '<div class="digitize-image digitize-remove"></div>'
+                          + '<div class="digitize-image digitize-export"></div>'
+                          + '</div>';
+
     var digitizeDialog,
         editDialog,
         attributesDialog,
@@ -269,7 +276,7 @@
                 var kml = $('#mapframe1').data('kml');
                 var url = $(this).parent().parent().attr('title');
                 kml.zoomToFeature(url, idx);
-                editObject($(this), null)();
+                editObject($(this), null)(e);
             });
             $('li[title="' + url + '"] > .digitize-menu-arrow').die('click').live('click', contextmenuLayer);
             $('li[title="' + url + '"] > ul > li > .digitize-menu-arrow').die('click').live('click', contextmenuObject);
@@ -500,7 +507,7 @@
     };
 
     var editObject = function($link, menu) {
-        return function() {
+        return function(e) {
             editDialog.find('*').unbind();
             if($link.hasClass('kmltree-selected')) {
                 editDialog.dialog('close');

Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js	2014-07-01 09:54:28 UTC (rev 8955)
+++ trunk/mapbender/http/widgets/w_digitize.js	2014-07-01 12:30:11 UTC (rev 8956)
@@ -24,6 +24,8 @@
     _polygonIsInvalid: false,
     _currentPolygonIsInvalid: false,
     _canvas: undefined,
+    reinitializeProxy: null,
+    addPointProxy: null,
 
     _isPolygon: function (pos) {
 
@@ -304,7 +306,7 @@
 
     _reinitialize: function (e) {
         this.element
-            .unbind("click", $.proxy(this, "_reinitialize"))
+            .unbind("click", this.reinitializeProxy)
         this._trigger("reinitialize", e);
         return false;
     },
@@ -312,10 +314,10 @@
     _addLastPoint: function (e) {
         this._trigger("lastpointadded", e);
 
-        this.element.unbind("click", this._addPoint)
+        this.element.unbind("click", this.addPointProxy)
             .unbind("mousemove", this._digitize)
             .css("cursor", "auto")
-            .bind("click", $.proxy(this, "_reinitialize"));
+            .bind("click", this.reinitializeProxy);
     },
 
     _addPoint: function (e) {
@@ -363,10 +365,10 @@
         }
 
         if(this.options.type === 'point') {
-            this.element.unbind('click', this._addPoint)
+            this.element.unbind('click', this.addPointProxy)
                 .unbind("mousemove", this._digitize)
                 .css('cursor', 'auto')
-                .bind('click', $.proxy(this, '_reinitialize'));
+                .bind('click', this.reinitializeProxy);
             this._trigger("lastpointadded", e);
         }
 
@@ -422,7 +424,7 @@
 
     startDigitizing: function() {
         this.element
-            .bind("click", $.proxy(this, "_addPoint"))
+            .bind("click", this.addPointProxy)
             .bind("mousemove", $.proxy(this, "_digitize"))
             .css("cursor", "crosshair");
     },
@@ -579,7 +581,7 @@
 
     modeOff: function() {
         this.element
-            .unbind('mousedown').unbind('mousemove').unbind('mouseup').unbind('click');
+            .unbind('mousedown').unbind('mousemove').unbind('mouseup').unbind('click', this.addPointProxy);
         this.addingVertex = false;
         this._redraw();
     },
@@ -614,6 +616,9 @@
     },
 
     _create: function () {
+        this.reinitializeProxy = $.proxy(this, this._reinitialize);
+        this.addPointProxy = $.proxy(this, this._addPoint);
+
         this._digitizePoints = [];
 
         // ":maps" is a Mapbender selector which
@@ -638,9 +643,9 @@
     // the digitized geometry will be available, the events will be deleted
     deactivate: function () {
         this.element
-            .unbind("click", this._addPoint)
+            .unbind("click", this.addPointProxy)
             .unbind("mousemove", this._digitize)
-            .unbind("click", this._reinitialize)
+            .unbind("click", this.reinitializeProxy)
             .css("cursor", "default");
     },
     // delete everything



More information about the Mapbender_commits mailing list