SelectFeature should allow panning the map when over features, without activating click method at the end of drag, r=tschaub (closes #1824)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9194 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2009-04-06 11:46:15 +00:00
parent f372bd3fd1
commit bcf29b8a65
2 changed files with 66 additions and 11 deletions

View File

@@ -56,13 +56,13 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
up: null,
/**
* Property: clickoutTolerance
* {Number} The number of pixels the mouse can move during a click that
* still constitutes a click out. When dragging the map, clicks should
* not trigger the clickout property unless this tolerance is reached.
* Default is 4.
* Property: clickTolerance
* {Number} The number of pixels the mouse can move between mousedown
* and mouseup for the event to still be considered a click.
* Dragging the map should not trigger the click and clickout callbacks
* unless the map is moved by less than this tolerance. Defaults to 4.
*/
clickoutTolerance: 4,
clickTolerance: 4,
/**
* Property: geometryTypes
@@ -275,7 +275,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
/**
* Method: triggerCallback
* Call the callback keyed in the event map with the supplied arguments.
* For click out, the <clickoutTolerance> is checked first.
* For click and clickout, the <clickTolerance> is checked first.
*
* Parameters:
* type - {String}
@@ -283,13 +283,13 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
triggerCallback: function(type, mode, args) {
var key = this.EVENTMAP[type][mode];
if(key) {
if(type == 'click' && mode == 'out' && this.up && this.down) {
// for clickout, only trigger callback if tolerance is met
if(type == 'click' && this.up && this.down) {
// for click/clickout, only trigger callback if tolerance is met
var dpx = Math.sqrt(
Math.pow(this.up.x - this.down.x, 2) +
Math.pow(this.up.y - this.down.y, 2)
);
if(dpx <= this.clickoutTolerance) {
if(dpx <= this.clickTolerance) {
this.callback(key, args);
}
} else {