Skip to content

Commit

Permalink
move the scale bar away from the border
Browse files Browse the repository at this point in the history
  • Loading branch information
enrico ferreguti committed Apr 27, 2024
1 parent dee127a commit 6b12463
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/printTool/printDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export default {
const mapElement = this.map.getTargetElement();
const mapElementClass = mapElement.className;
mapElement.className = '';
const scaleLineElement = document.getElementsByClassName('ol-scale-bar')[0]
let dim = this.dims[this.format];
if (this.orientation === this.$t('wgu-print.portrait')) dim = dim.reverse();
const scale = this.scales[this.scale];
Expand Down Expand Up @@ -204,6 +205,8 @@ export default {
pdf.save('map.pdf');
// Reset original map size
me.scaleLine.setDpi();
scaleLineElement.style.left = '';
scaleLineElement.style.bottom = '';
mapElement.className = mapElementClass;
mapElement.style.width = '';
mapElement.style.height = '';
Expand All @@ -214,9 +217,10 @@ export default {
// Set print size
this.scaleLine.setDpi(parseInt(this.resolution));
scaleLineElement.style.left = '10mm';
scaleLineElement.style.bottom = '10mm';
mapElement.style.width = width + 'px';
mapElement.style.height = height + 'px';
console.log('render sizes', this.map.getTargetElement().style.width, this.map.getTargetElement().style.height)
this.map.getView().setResolution(scaleResolution);
this.map.updateSize();
}
Expand Down

0 comments on commit 6b12463

Please sign in to comment.