[Mapbender-commits] r8859 - in trunk/mapbender/http: plugins widgets
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed May 14 00:46:39 PDT 2014
Author: hwbllmnn
Date: 2014-05-14 00:46:39 -0700 (Wed, 14 May 2014)
New Revision: 8859
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
trunk/mapbender/http/widgets/w_digitize.js
Log:
added moving of vertices
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-14 06:45:12 UTC (rev 8858)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-14 07:46:39 UTC (rev 8859)
@@ -402,7 +402,7 @@
that.activate();
};
- var featureMoved = function() {
+ var featureModified = function() {
var kml = $('#mapframe1').data('kml');
var digit = o.$target.data('mb_digitize');
var pts = digit._digitizePoints;
@@ -434,7 +434,7 @@
o.editedFeature = editedFeature;
o.$target
.mb_digitize(o)
- .bind('mb_digitizefeaturemoved', featureMoved);
+ .bind('mb_digitizefeaturemodified', featureModified);
}
}
if (!inProgress) {
Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js 2014-05-14 06:45:12 UTC (rev 8858)
+++ trunk/mapbender/http/widgets/w_digitize.js 2014-05-14 07:46:39 UTC (rev 8859)
@@ -453,11 +453,47 @@
stopMoving: function(e) {
this.moving = false;
- this._trigger("featuremoved", e);
+ this._trigger('featuremodified', e);
},
+ startVertexMoving: function(e) {
+ var pt = this.pointFromEvent(e);
+ var self = this;
+ this.vertexMoving = false;
+ $.each(this._digitizePoints, function(k, v) {
+ if(self._isPointSnapped(v.mousePos, pt.mousePos)) {
+ self.vertexMoving = true;
+ self.vertexMovingIndex = k;
+ return;
+ }
+ });
+ },
+
+ vertexMove: function(e) {
+ if(this.vertexMoving) {
+ var pt = this.pointFromEvent(e);
+ this._digitizePoints[this.vertexMovingIndex] = pt;
+ }
+ this._redraw();
+ },
+
+ stopVertexMoving: function(e) {
+ this.vertexMoving = false;
+ this._trigger('featuremodified', e);
+ },
+
+ moveVertexMode: function() {
+ this.element
+ .unbind('mousedown').unbind('mousemove').unbind('mouseup')
+ .bind('mousedown', $.proxy(this, 'startVertexMoving'))
+ .bind('mousemove', $.proxy(this, 'vertexMove'))
+ .bind('mouseup', $.proxy(this, 'stopVertexMoving'))
+ .css('cursor', 'crosshair');
+ },
+
moveMode: function() {
this.element
+ .unbind('mousedown').unbind('mousemove').unbind('mouseup')
.bind("mousedown", $.proxy(this, 'startMoving'))
.bind("mousemove", $.proxy(this, 'move'))
.bind('mouseup', $.proxy(this, 'stopMoving'))
More information about the Mapbender_commits
mailing list