Skip to content

Commit

Permalink
Merge pull request #1049 from venkatesh-brightly/bug-fix/re-ordering
Browse files Browse the repository at this point in the history
#1048:  Layerswitcher re-ordering issue in web component
  • Loading branch information
Viglino authored Apr 10, 2024
2 parents 18f5ffc + 5945a35 commit 8c30f7f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/control/LayerSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,18 @@ var ol_control_LayerSwitcher = class olcontrolLayerSwitcher extends ol_control_C
var li
if (!e.touches) {
li = e.target

// Get the HTML node within web component on click drag
if(e.target.shadowRoot){
li = e.composedPath()[0]
}
} else {
li = document.elementFromPoint(e.touches[0].clientX, e.touches[0].clientY)
li = document.elementFromPoint(e.touches[0].clientX, e.touches[0].clientY);

//Get actual HTML node within web component on touch drag
while(li.shadowRoot){
li = li.shadowRoot.elementFromPoint(e.touches[0].clientX, e.touches[0].clientY)
}
}
if (li.classList.contains("ol-switcherbottomdiv")) {
self.overflow(-1)
Expand Down

0 comments on commit 8c30f7f

Please sign in to comment.