[Mapbender-commits] r8896 - in trunk/mapbender/http: plugins widgets
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed May 21 08:03:09 PDT 2014
Author: hwbllmnn
Date: 2014-05-21 08:03:09 -0700 (Wed, 21 May 2014)
New Revision: 8896
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/http/widgets/w_digitize.js
Log:
cleaned up event handling when modifying geometries' vertices
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-21 14:10:59 UTC (rev 8895)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-21 15:03:09 UTC (rev 8896)
@@ -500,8 +500,12 @@
//digit.modeOff();
var pts = $.extend(true, {}, digit._digitizePoints);
$.each(pts, function(_, v) {
+ if(!$.isPlainObject(v.pos)) {
+ v.pos = {x: v.pos.x, y: v.pos.y};
+ }
Proj4js.transform(kml.targetProj, kml.wgs84, v.pos);
});
+
if(status === 'edit-point') {
editedFeature.geometry.coordinates = [pts[0].pos.x, pts[0].pos.y];
} else if(status === 'edit-line') {
@@ -527,6 +531,8 @@
o.editedFeature = null;
o.$target
.mb_digitize(o)
+ .mb_digitize('modeOff')
+ .mb_digitize('startDigitizing')
.unbind('mb_digitizelastpointadded')
.unbind('mb_digitizereinitialize')
.bind("mb_digitizelastpointadded", finishDigitize)
@@ -538,6 +544,7 @@
o.editedFeature = editedFeature;
o.$target
.mb_digitize(o)
+ .mb_digitize('modeOff')
.unbind('mb_digitizefeaturemodified')
.bind('mb_digitizefeaturemodified', featureModified);
}
Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js 2014-05-21 14:10:59 UTC (rev 8895)
+++ trunk/mapbender/http/widgets/w_digitize.js 2014-05-21 15:03:09 UTC (rev 8896)
@@ -416,19 +416,26 @@
this._digitizePoints = this.coordinatesToDigitizePoints(this.options.editedFeature.geometry.coordinates);
this._redraw();
} else {
- this.element
- .bind("click", $.proxy(this, "_addPoint"))
- .bind("mousemove", $.proxy(this, "_digitize"))
- .css("cursor", "crosshair");
+ this.startDigitizing();
}
},
+ startDigitizing: function() {
+ this.element
+ .bind("click", $.proxy(this, "_addPoint"))
+ .bind("mousemove", $.proxy(this, "_digitize"))
+ .css("cursor", "crosshair");
+ },
+
pointFromEvent: function(e) {
var mousePos = this._map.getMousePosition(e);
+ var kml = $('#mapframe1').data('kml');
+ var pos = this._map.convertPixelToReal(mousePos);
+
return {
mousePos: mousePos,
- pos: this._map.convertPixelToReal(mousePos)
+ pos: pos
};
},
@@ -531,9 +538,9 @@
},
addVertexMode: function() {
+ this.modeOff();
this.addingVertex = true;
this.element
- .unbind('mousedown').unbind('mousemove').unbind('mouseup')
.bind('mousedown', $.proxy(this, 'addVertex'))
.bind('mousemove', $.proxy(this, 'vertexMove'))
.bind('mouseup', $.proxy(this, 'stopVertexMoving'))
@@ -555,15 +562,15 @@
},
deleteVertexMode: function() {
+ this.modeOff();
this.element
- .unbind('mousedown').unbind('mousemove').unbind('mouseup')
.bind('mousedown', $.proxy(this, 'deleteVertex'))
.css('cursor', 'crosshair');
},
moveMode: function() {
+ this.modeOff();
this.element
- .unbind('mousedown').unbind('mousemove').unbind('mouseup')
.bind("mousedown", $.proxy(this, 'startMoving'))
.bind("mousemove", $.proxy(this, 'move'))
.bind('mouseup', $.proxy(this, 'stopMoving'))
@@ -572,7 +579,9 @@
modeOff: function() {
this.element
- .unbind('mousedown').unbind('mousemove').unbind('mouseup');
+ .unbind('mousedown').unbind('mousemove').unbind('mouseup').unbind('click');
+ this.addingVertex = false;
+ this._redraw();
},
coordinatesToDigitizePoints: function(coords) {
More information about the Mapbender_commits
mailing list