Skip to content

Commit

Permalink
Follow up of #4044
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Mar 25, 2024
1 parent ecfafac commit 0f9933f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
5 changes: 1 addition & 4 deletions assets/src/components/MousePosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
3 changes: 0 additions & 3 deletions assets/src/components/Print.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 2 additions & 3 deletions assets/src/legacy/edition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 2 additions & 3 deletions assets/src/legacy/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -2711,16 +2711,15 @@ 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();
}
},
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() {
Expand Down
2 changes: 0 additions & 2 deletions assets/src/modules/Digitizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
6 changes: 5 additions & 1 deletion assets/src/modules/Lizmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

/**
Expand Down
3 changes: 0 additions & 3 deletions assets/src/modules/interaction/Draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export default class Draw {
this.clear();
}

// mainLizmap.newOlMap = true;

this._drawSource = new VectorSource();

this._dispatchAddFeature = () => {
Expand Down Expand Up @@ -103,7 +101,6 @@ export default class Draw {

set visible(visible) {
this._drawLayer.setVisible(visible);
// mainLizmap.newOlMap = visible;
}

get features() {
Expand Down
4 changes: 4 additions & 0 deletions assets/src/modules/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f9933f

Please sign in to comment.