commit ba7d4086421765a49d958227247935862a6419f1
parent 65b3f3b35bbcf0827c5ba2982c9bb4fab5c21cc9
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sat, 18 Feb 2017 14:58:38 +0300
[print control] do not minimize on start if has pages
Diffstat:
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/App.js b/src/App.js
@@ -69,10 +69,12 @@ function setUp() {
/////////// controls bottom-left corner
- new L.Control.PrintPages({position: 'bottomleft'})
+ const printControl = new L.Control.PrintPages({position: 'bottomleft'})
.addTo(map)
- .enableHashState('p')
- .setMinimized();
+ .enableHashState('p');
+ if (!printControl.hasPages()) {
+ printControl.setMinimized();
+ }
/////////// controls bottom-right corner
diff --git a/src/lib/leaflet.control.printPages/control.js b/src/lib/leaflet.control.printPages/control.js
@@ -346,6 +346,10 @@ L.Control.PrintPages = L.Control.extend({
this.fire('change');
},
+ hasPages: function() {
+ return !!this.pages.length
+ },
+
serializeState: function() {
const pages = this.pages;
let state = null;
@@ -396,8 +400,6 @@ L.Control.PrintPages = L.Control.extend({
this.addPage(!!rotated, L.latLng(lat, lng));
}
return true;
-
-
}
}
);