Make ol/interaction/Select#handleEvent return always true.
Previously it was returning true only if the event was a pointerMove which prevented multiple Select objects with other event types from working.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import {click, pointerMove, altKeyOnly} from '../src/ol/events/condition.js';
|
import {click, altKeyOnly} from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import Select from '../src/ol/interaction/Select.js';
|
import Select from '../src/ol/interaction/Select.js';
|
||||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||||
@@ -39,7 +39,9 @@ const selectClick = new Select({
|
|||||||
|
|
||||||
// select interaction working on "pointermove"
|
// select interaction working on "pointermove"
|
||||||
const selectPointerMove = new Select({
|
const selectPointerMove = new Select({
|
||||||
condition: pointerMove
|
condition: function(mapBrowserEvent) {
|
||||||
|
return mapBrowserEvent.type == 'pointermove';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const selectAltClick = new Select({
|
const selectAltClick = new Select({
|
||||||
|
|||||||
@@ -110,19 +110,6 @@ export const mouseActionButton = function(mapBrowserEvent) {
|
|||||||
export const never = FALSE;
|
export const never = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return `true` if the browser event is a `pointermove` event, `false`
|
|
||||||
* otherwise.
|
|
||||||
*
|
|
||||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
|
||||||
* @return {boolean} True if the browser event is a `pointermove` event.
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
export const pointerMove = function(mapBrowserEvent) {
|
|
||||||
return mapBrowserEvent.type == 'pointermove';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return `true` if the event is a map `singleclick` event, `false` otherwise.
|
* Return `true` if the event is a map `singleclick` event, `false` otherwise.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {getUid} from '../util.js';
|
|||||||
import CollectionEventType from '../CollectionEventType.js';
|
import CollectionEventType from '../CollectionEventType.js';
|
||||||
import {extend, includes} from '../array.js';
|
import {extend, includes} from '../array.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
import {singleClick, never, shiftKeyOnly, pointerMove} from '../events/condition.js';
|
import {singleClick, never, shiftKeyOnly} from '../events/condition.js';
|
||||||
import {TRUE} from '../functions.js';
|
import {TRUE} from '../functions.js';
|
||||||
import GeometryType from '../geom/GeometryType.js';
|
import GeometryType from '../geom/GeometryType.js';
|
||||||
import Interaction from './Interaction.js';
|
import Interaction from './Interaction.js';
|
||||||
@@ -468,7 +468,7 @@ function handleEvent(mapBrowserEvent) {
|
|||||||
new SelectEvent(SelectEventType.SELECT,
|
new SelectEvent(SelectEventType.SELECT,
|
||||||
selected, deselected, mapBrowserEvent));
|
selected, deselected, mapBrowserEvent));
|
||||||
}
|
}
|
||||||
return pointerMove(mapBrowserEvent);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user