@@ -488,7 +488,7 @@ export var MapMLLayer = L.Layer.extend({
488488 opacityControl = document . createElement ( 'details' ) ,
489489 opacityControlSummary = document . createElement ( 'summary' ) ,
490490 opacityControlSummaryLabel = document . createElement ( 'label' ) ,
491- root = this . _layerEl . parentElement . shadowRoot , map = this . _map ;
491+ root = this . _layerEl . parentElement . shadowRoot , map = this . _map , viewer = this . _layerEl . parentNode ;
492492
493493 input . defaultChecked = this . _map ? true : false ;
494494 input . type = 'checkbox' ;
@@ -554,6 +554,11 @@ export var MapMLLayer = L.Layer.extend({
554554 layers = map . getPane ( "overlayPane" ) . children ,
555555 zIndex = 1 ;
556556 for ( let control of controls ) {
557+ let layerEl = control . querySelector ( "span" ) . layer . _layerEl ;
558+ layerEl . setAttribute ( "moving" , "" ) ;
559+ viewer . insertAdjacentElement ( "beforeend" , layerEl ) ;
560+ layerEl . removeAttribute ( "moving" ) ;
561+
557562 for ( let layer of layers ) {
558563 if ( control . querySelector ( "span" ) . layer . _container == layer ) {
559564 layer . style [ "z-index" ] = zIndex ;
@@ -564,19 +569,6 @@ export var MapMLLayer = L.Layer.extend({
564569 } ;
565570
566571 L . DomEvent . on ( opacity , 'change' , this . _changeOpacity , this ) ;
567- /* L.DomEvent.on(details,'ondrag', function(event) {
568- console.log("HERE2");
569- // will have to figure out how to drag and drop a whole element
570- // with its contents in the case where the <layer->content</layer->
571- // has no src but does have inline content.
572- // Should be do-able, I think.
573- if (this._href) {
574- event.dataTransfer.setData("text/uri-list",this._href);
575- // Why use a second .setData("text/plain"...) ? This is very important:
576- // See https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#link
577- event.dataTransfer.setData("text/plain", this._href);
578- }
579- }, this); */
580572
581573 fieldset . appendChild ( details ) ;
582574 details . appendChild ( summary ) ;
0 commit comments