Skip to content

Commit c942e2f

Browse files
committed
Adjust popup height to fit screen
1 parent 593763a commit c942e2f

5 files changed

+30
-30
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fcoo-observations",
3-
"version": "4.10.1",
3+
"version": "4.10.2",
44
"homepage": "https://github.com/FCOO/fcoo-observations",
55
"authors": [
66
"Niels Holt"

demo/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
fcooObservation.closeVisiblePopup(groupId, maps[mapIndex]);
162162
}
163163

164-
window.INCLUDETABLESINMODEL = true;
164+
window.INCLUDETABLESINMODAL = true;
165165

166166
$(function() {
167167
maps.push( L.map('map0').setView([56.2, 11.5], 6) );

dist/fcoo-observations.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
ns.FCOOObservations = function(options = {}){
5555
var _this = this;
5656
this.options = $.extend(true, {}, {
57-
VERSION : "4.10.1",
57+
VERSION : "4.10.2",
5858
subDir : {
5959
observations: 'observations',
6060
forecasts : 'forecasts'
@@ -2670,7 +2670,8 @@ return result;
26702670
addPopup
26712671
*********************************************/
26722672
addPopup: function(mapId, marker){
2673-
var _this = this;
2673+
let scrollContent = this.observationGroupList.length > 2;
2674+
26742675
marker.bindPopup({
26752676
width : 250, //265,
26762677

@@ -2697,17 +2698,17 @@ return result;
26972698
content : this.createNormalPopupContent,
26982699
contentContext: this,
26992700
dynamic : true,
2700-
scroll : true,
2701+
scroll : scrollContent,
2702+
maxHeight : scrollContent ? 400 : null,
27012703
buttons: [{
27022704
id : 'mini',
27032705
icon : 'far fa-message-middle',
27042706
text : {da: 'Vis', en: 'Show'},
27052707
title : {da: 'Vis seneste måling', en: 'Show latest measurement'},
27062708
class : 'min-width',
27072709
context: this,
2708-
onClick: function(){
2709-
this.popupMinimized( mapId );
2710-
}
2710+
//onClick: function(){ this.popupMinimized( mapId ); }
2711+
onClick: this.popupMinimized.bind(this, mapId)
27112712

27122713
},{
27132714
id : 'extend',
@@ -2717,29 +2718,28 @@ return result;
27172718
_text : {da:'Vis graf', en:'Show Chart'},
27182719
text : {da:'Graf', en:'Chart'},
27192720

2720-
onClick : function(){ _this.showCharts(mapId); },
2721+
onClick : this.showCharts.bind(this, mapId),
27212722
/*
27222723
onClick : function(){
27232724
$.bsModal({
2724-
header: _this.getHeader(),
2725+
header: this.getHeader.bind(this),
27252726
flexWidth: true,
27262727
megaWidth: true,
2727-
content: function( $body ){
2728-
_this.createCharts($body, true, mapId);
2729-
},
2728+
content: this.createCharts.bind(this, $body, true, mapId)
27302729
remove: true,
27312730
show: true
27322731
});
27332732
marker._popup.setSizeExtended();
2734-
}
2733+
}.bind(this)
27352734
*/
2736-
}, window.INCLUDETABLESINMODEL ? {
2735+
}, window.INCLUDETABLESINMODAL ? {
27372736
id : 'table',
27382737
icon : 'far fa-table',
27392738
_text : {da:'Vis tabel', en:'Show Table'},
27402739
text : {da:'Tabel', en:'Table'},
27412740

2742-
onClick: function(){ _this.showTables(mapId); },
2741+
//onClick: function(){ _this.showTables(mapId); },
2742+
onClick: this.showTables.bind(this, mapId),
27432743
} : undefined],
27442744
footer: {da:'Format: Min'+nsObservations.toChar+'Maks (Middel)', en:'Format: Min'+nsObservations.toChar+'Max (Mean)'},
27452745

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fcoo-observations",
3-
"version": "4.10.1",
3+
"version": "4.10.2",
44
"homepage": "https://github.com/FCOO/fcoo-observations",
55
"author": "Niels Holt [email protected]",
66
"description": "package.json is only use for building the package. see bower.json for more info",

src/50_fcoo-observations-leaflet.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@
568568
addPopup
569569
*********************************************/
570570
addPopup: function(mapId, marker){
571-
var _this = this;
571+
let scrollContent = this.observationGroupList.length > 2;
572+
572573
marker.bindPopup({
573574
width : 250, //265,
574575

@@ -595,17 +596,17 @@
595596
content : this.createNormalPopupContent,
596597
contentContext: this,
597598
dynamic : true,
598-
scroll : true,
599+
scroll : scrollContent,
600+
maxHeight : scrollContent ? 400 : null,
599601
buttons: [{
600602
id : 'mini',
601603
icon : 'far fa-message-middle',
602604
text : {da: 'Vis', en: 'Show'},
603605
title : {da: 'Vis seneste måling', en: 'Show latest measurement'},
604606
class : 'min-width',
605607
context: this,
606-
onClick: function(){
607-
this.popupMinimized( mapId );
608-
}
608+
//onClick: function(){ this.popupMinimized( mapId ); }
609+
onClick: this.popupMinimized.bind(this, mapId)
609610

610611
},{
611612
id : 'extend',
@@ -615,29 +616,28 @@
615616
_text : {da:'Vis graf', en:'Show Chart'},
616617
text : {da:'Graf', en:'Chart'},
617618

618-
onClick : function(){ _this.showCharts(mapId); },
619+
onClick : this.showCharts.bind(this, mapId),
619620
/*
620621
onClick : function(){
621622
$.bsModal({
622-
header: _this.getHeader(),
623+
header: this.getHeader.bind(this),
623624
flexWidth: true,
624625
megaWidth: true,
625-
content: function( $body ){
626-
_this.createCharts($body, true, mapId);
627-
},
626+
content: this.createCharts.bind(this, $body, true, mapId)
628627
remove: true,
629628
show: true
630629
});
631630
marker._popup.setSizeExtended();
632-
}
631+
}.bind(this)
633632
*/
634-
}, window.INCLUDETABLESINMODEL ? {
633+
}, window.INCLUDETABLESINMODAL ? {
635634
id : 'table',
636635
icon : 'far fa-table',
637636
_text : {da:'Vis tabel', en:'Show Table'},
638637
text : {da:'Tabel', en:'Table'},
639638

640-
onClick: function(){ _this.showTables(mapId); },
639+
//onClick: function(){ _this.showTables(mapId); },
640+
onClick: this.showTables.bind(this, mapId),
641641
} : undefined],
642642
footer: {da:'Format: Min'+nsObservations.toChar+'Maks (Middel)', en:'Format: Min'+nsObservations.toChar+'Max (Mean)'},
643643

0 commit comments

Comments
 (0)