diff --git a/assets/src/components/MousePosition.js b/assets/src/components/MousePosition.js index 98669689b4..4ba0b35758 100644 --- a/assets/src/components/MousePosition.js +++ b/assets/src/components/MousePosition.js @@ -110,13 +110,10 @@ export default class MousePosition extends HTMLElement { }); } mainLizmap.map.addLayer(this._MGRS); - - // mainLizmap.newOlMap = true; - }else{ + } else { if(this._MGRS){ mainLizmap.map.removeLayer(this._MGRS); } - // mainLizmap.newOlMap = false; } } diff --git a/assets/src/components/Print.js b/assets/src/components/Print.js index 505759552a..4990574cbb 100644 --- a/assets/src/components/Print.js +++ b/assets/src/components/Print.js @@ -41,8 +41,6 @@ export default class Print extends HTMLElement { lizMap.events.on({ minidockopened: (e) => { if ( e.id == 'print' ) { - // mainLizmap.newOlMap = true; - this._projectionUnit = getProjection(mainLizmap.qgisProjectProjection).getUnits(); if (this._projectionUnit === 'degrees') { @@ -109,7 +107,6 @@ export default class Print extends HTMLElement { }, minidockclosed: (e) => { if ( e.id == 'print' ) { - // mainLizmap.newOlMap = false; mainLizmap.map.removeLayer(this._maskLayer); mainLizmap.map.getView().un('change:resolution', this._onChangeResolution); } diff --git a/assets/src/legacy/edition.js b/assets/src/legacy/edition.js index 2e3bbd5442..ea36733937 100644 --- a/assets/src/legacy/edition.js +++ b/assets/src/legacy/edition.js @@ -655,7 +655,7 @@ var lizEdition = function() { function finishEdition() { // Put old OL2 map at bottom - document.getElementById("newOlMap").style.zIndex = 750; + lizMap.mainLizmap.newOlMap = true; // Lift the constraint on edition lizMap.editionPending = false; @@ -1273,8 +1273,7 @@ var lizEdition = function() { function launchEdition( aLayerId, aFid, aParent, aCallback ) { // Put old OL2 map on top and synchronize position with new OL map - document.getElementById("newOlMap").style.zIndex = 'unset'; - lizMap.mainLizmap.map.refreshOL2View(); + lizMap.mainLizmap.newOlMap = false; var editedFeature = new FeatureEditionData(aLayerId, null, null); diff --git a/assets/src/legacy/map.js b/assets/src/legacy/map.js index 88fc4e7c2d..b6e772ab49 100644 --- a/assets/src/legacy/map.js +++ b/assets/src/legacy/map.js @@ -2711,8 +2711,7 @@ window.lizMap = function() { minidockopened: function(e) { if ( e.id == 'measure' ) { // Put old OL2 map on top and synchronize position with new OL map - document.getElementById("newOlMap").style.zIndex = 'unset'; - lizMap.mainLizmap.map.refreshOL2View(); + lizMap.mainLizmap.newOlMap = false; $('#measure-type').change(); } @@ -2720,7 +2719,7 @@ window.lizMap = function() { minidockclosed: function(e) { if ( e.id == 'measure' ) { // Put old OL2 map at bottom - document.getElementById("newOlMap").style.zIndex = 750; + lizMap.mainLizmap.newOlMap = true; var activeCtrl = ''; $('#measure-type option').each(function() { diff --git a/assets/src/modules/Digitizing.js b/assets/src/modules/Digitizing.js index 8350f0c9ef..f83143f508 100644 --- a/assets/src/modules/Digitizing.js +++ b/assets/src/modules/Digitizing.js @@ -269,13 +269,11 @@ export default class Digitizing { } else if (['draw', 'selectiontool', 'print'].includes(e.id)) { // Display draw for print redlining this.context = e.id === 'print' ? 'draw' : e.id; - // mainLizmap.newOlMap = true; this.toggleVisibility(true); } }, minidockclosed: (e) => { if (['draw', 'selectiontool', 'print'].includes(e.id)) { - // mainLizmap.newOlMap = false; this.toggleVisibility(false); } } diff --git a/assets/src/modules/Lizmap.js b/assets/src/modules/Lizmap.js index 4b7b4f562f..d997498efb 100644 --- a/assets/src/modules/Lizmap.js +++ b/assets/src/modules/Lizmap.js @@ -185,7 +185,11 @@ export default class Lizmap { */ set newOlMap(mode){ this.map._newOlMap = mode; - document.getElementById('newOlMap').style.zIndex = mode ? 750 : 'auto'; + document.getElementById('newOlMap').style.zIndex = mode ? 750 : 'unset'; + + if (!mode) { + this.map.refreshOL2View(); + } } /** diff --git a/assets/src/modules/interaction/Draw.js b/assets/src/modules/interaction/Draw.js index a4fbf516ad..8ef931ac5d 100644 --- a/assets/src/modules/interaction/Draw.js +++ b/assets/src/modules/interaction/Draw.js @@ -35,8 +35,6 @@ export default class Draw { this.clear(); } - // mainLizmap.newOlMap = true; - this._drawSource = new VectorSource(); this._dispatchAddFeature = () => { @@ -103,7 +101,6 @@ export default class Draw { set visible(visible) { this._drawLayer.setVisible(visible); - // mainLizmap.newOlMap = visible; } get features() { diff --git a/assets/src/modules/map.js b/assets/src/modules/map.js index 9baf0e1141..ac6ae2e3ce 100644 --- a/assets/src/modules/map.js +++ b/assets/src/modules/map.js @@ -561,6 +561,10 @@ export default class map extends olMap { this.on('moveend', () => { this._dispatchMapStateChanged(); + + if (!mainLizmap.newOlMap) { + lizMap.map.setCenter(undefined,this.getView().getZoom(), false, false); + } }); // Init view