Skip to content

Commit

Permalink
[BUG] use getElement() #985
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Aug 16, 2023
1 parent da1ccdb commit 76c8638
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions dist/ol-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -23204,8 +23204,9 @@ ol.interaction.DragOverlay = class olinteractionDragOverlay extends ol.interacti
if (o === ov)
return;
}
var element = ov.getElement();
// Stop event overlay
if (ov.element.parentElement && ov.element.parentElement.classList.contains('ol-overlaycontainer-stopevent')) {
if (element.parentElement && element.parentElement.classList.contains('ol-overlaycontainer-stopevent')) {
console.warn('[DragOverlay.addOverlay] overlay must be created with stopEvent set to false!');
return;
}
Expand All @@ -23218,7 +23219,7 @@ ol.interaction.DragOverlay = class olinteractionDragOverlay extends ol.interacti
overlay: ov,
listener: handler
});
ov.element.addEventListener('pointerdown', handler);
element.addEventListener('pointerdown', handler);
}
/** Remove an overlay from the interacton
* @param {ol.Overlay} ov
Expand All @@ -23227,7 +23228,7 @@ ol.interaction.DragOverlay = class olinteractionDragOverlay extends ol.interacti
for (var i = 0, o; o = this._overlays[i]; i++) {
if (o.overlay === ov) {
var l = this._overlays.splice(i, 1)[0];
ov.element.removeEventListener('pointerdown', l.listener);
ov.getElement().removeEventListener('pointerdown', l.listener);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/ol-ext.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/interaction/DragOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ var ol_interaction_DragOverlay = class olinteractionDragOverlay extends ol_inter
if (o === ov)
return;
}
var element = ov.getElement();
// Stop event overlay
if (ov.element.parentElement && ov.element.parentElement.classList.contains('ol-overlaycontainer-stopevent')) {
if (element.parentElement && element.parentElement.classList.contains('ol-overlaycontainer-stopevent')) {
console.warn('[DragOverlay.addOverlay] overlay must be created with stopEvent set to false!');
return;
}
Expand All @@ -106,7 +107,7 @@ var ol_interaction_DragOverlay = class olinteractionDragOverlay extends ol_inter
overlay: ov,
listener: handler
});
ov.element.addEventListener('pointerdown', handler);
element.addEventListener('pointerdown', handler);
}
/** Remove an overlay from the interacton
* @param {ol.Overlay} ov
Expand All @@ -115,7 +116,7 @@ var ol_interaction_DragOverlay = class olinteractionDragOverlay extends ol_inter
for (var i = 0, o; o = this._overlays[i]; i++) {
if (o.overlay === ov) {
var l = this._overlays.splice(i, 1)[0];
ov.element.removeEventListener('pointerdown', l.listener);
ov.getElement().removeEventListener('pointerdown', l.listener);
break;
}
}
Expand Down

0 comments on commit 76c8638

Please sign in to comment.