Skip to content

Commit

Permalink
fix: Box selection does not work when the map is not full height (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Jan 14, 2025
1 parent b98c9a7 commit f052254
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion map/client/composables/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function useSelection (name, options = {}) {
else handleSelection(items, clearSelection)
}
function onBoxSelection (map, event) {
lastBoxSelectionPosition = L.point(_.get(event, 'x'), _.get(event, 'y'))
lastBoxSelectionPosition = _.get(event, 'containerPoint')
const { bounds } = event
let items = getIntersectedItems(bboxPolygon([
bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth()
Expand Down
4 changes: 2 additions & 2 deletions map/client/leaflet/BoxSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const BoxSelection = L.Handler.extend({
this._box = L.DomUtil.create('div', 'leaflet-zoom-box', this._container)
L.DomUtil.addClass(this._container, 'leaflet-crosshair')

this._map.fire('boxselectionstart')
this._map.fire('boxselectionstart', Object.assign(e, { containerPoint: this._startPoint }))
}

this._point = this._map.mouseEventToContainerPoint(e)
Expand Down Expand Up @@ -127,7 +127,7 @@ export const BoxSelection = L.Handler.extend({
this._map.containerPointToLatLng(this._point))

this._map
.fire('boxselectionend', Object.assign(e, { bounds }))
.fire('boxselectionend', Object.assign(e, { bounds, containerPoint: this._map.mouseEventToContainerPoint(e) }))
},

_onKeyDown: function (e) {
Expand Down

0 comments on commit f052254

Please # to comment.