[fusion-commits] r2724 - trunk/lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed May 29 01:25:25 PDT 2013
Author: jng
Date: 2013-05-29 01:25:25 -0700 (Wed, 29 May 2013)
New Revision: 2724
Modified:
trunk/lib/Map.js
Log:
#570: Cancel active digitizaton if a subsequent digitize call is made. Also add guards to prevent subsequent bogus digitizer activated/deactivated events.
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2013-05-29 07:20:22 UTC (rev 2723)
+++ trunk/lib/Map.js 2013-05-29 08:25:25 UTC (rev 2724)
@@ -1762,17 +1762,21 @@
this._triggerDigitizerActivated();
},
_triggerDigitizerActivated: function() {
- this.isDigitizing = true;
- this.triggerEvent(Fusion.Event.MAP_DIGITIZER_ACTIVATED);
- //console.log("digitizer activated")
+ if (!this.isDigitizing) {
+ this.isDigitizing = true;
+ this.triggerEvent(Fusion.Event.MAP_DIGITIZER_ACTIVATED);
+ //console.log("digitizer activated");
+ }
},
_triggerDigitizerDeactivated: function() {
- this.isDigitizing = false;
- try {
- this.message.clear();
- } catch (e) {}
- this.triggerEvent(Fusion.Event.MAP_DIGITIZER_DEACTIVATED);
- //console.log("digitizer de-activated")
+ if (this.isDigitizing) {
+ this.isDigitizing = false;
+ try {
+ this.message.clear();
+ } catch (e) {}
+ this.triggerEvent(Fusion.Event.MAP_DIGITIZER_DEACTIVATED);
+ //console.log("digitizer de-activated");
+ }
},
onKeyPress: function(e) {
if (this.isDigitizing) {
@@ -1795,6 +1799,9 @@
* {OpenLayers.Geometry.Point}
*/
digitizePoint: function(options, callback) {
+ if (this.isDigitizing) {
+ this.cancelDigitization();
+ }
var ctrl = this.oMapOL.getControl(this.DRAW_CONTROL_POINT);
if (ctrl == null) {
ctrl = new OpenLayers.Control.DrawFeature(
@@ -1828,6 +1835,9 @@
* {OpenLayers.Geometry.LineString}
*/
digitizeLine: function(options, callback) {
+ if (this.isDigitizing) {
+ this.cancelDigitization();
+ }
var ctrl = this.oMapOL.getControl(this.DRAW_CONTROL_LINE);
if (ctrl == null) {
ctrl = new OpenLayers.Control.DrawFeature(
@@ -1866,6 +1876,9 @@
* {OpenLayers.Geometry.LineString}
*/
digitizeLineString: function(options, callback) {
+ if (this.isDigitizing) {
+ this.cancelDigitization();
+ }
var ctrl = this.oMapOL.getControl(this.DRAW_CONTROL_LINESTR);
if (ctrl == null) {
ctrl = new OpenLayers.Control.DrawFeature(
@@ -1902,6 +1915,9 @@
* {OpenLayers.Geometry.Polygon}
*/
digitizeRectangle: function(options, callback) {
+ if (this.isDigitizing) {
+ this.cancelDigitization();
+ }
var ctrl = this.oMapOL.getControl(this.DRAW_CONTROL_RECT);
if (ctrl == null) {
ctrl = new OpenLayers.Control.DrawFeature(
@@ -1939,6 +1955,9 @@
* {OpenLayers.Geometry.Polygon}
*/
digitizePolygon: function(options, callback) {
+ if (this.isDigitizing) {
+ this.cancelDigitization();
+ }
var ctrl = this.oMapOL.getControl(this.DRAW_CONTROL_POLY);
if (ctrl == null) {
ctrl = new OpenLayers.Control.DrawFeature(
More information about the fusion-commits
mailing list