I am trying to make LayerList widget movable, The problem I face if user click on LayerList(On some layer) and move it, Layer list consider the user clicks on the Layer and toggle the visibility of the layer.
I want to avoid the toggle visibility when user move the widget.
I tried to get the click action of the layerList but no success.
Is there any way to solve it.
Also Is there any way to allow users to change the order of the layers by dragging layers
How are you make the LayerList movable? If using dojo dnd then you should just add a header portion and set the dnd handle to be the header div.
That's a good idea.
I allowed the user to click anywhere on the layerlist and move it. If I could replace the layer click function it would be good to add some custom code,
what about allowing the user to drag layers to reorder layers?
I played around with this for a little bit and here's what I ended up with: https://codepen.io/solowt/pen/yPeeeL?editors=1000#0
This isn't working completely. There is some logical problem with how the layers are reordered. I'm not sure where the issue is but if you really want this feature it should be doable with some work.
One thing I noticed is that I needed to push each swap event onto an array and then apply the changes after the user stopped dragging the layer element. The logical problem may be involved with how the new index is determined. I'll take a further look if I get a chance.