Skip to content

Commit

Permalink
Fix for hidden bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanwins committed Aug 23, 2017
1 parent 6b1c900 commit dc7455f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .npmignore
@@ -0,0 +1,2 @@
src/

2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "leaflet-easyprint",
"version": "2.1.2",
"version": "2.1.6",
"description": "A leaflet plugin which adds an icon to print the map",
"main": "dist/leaflet.easyPrint.js",
"main": "dist/bundle.js",
"repository": {
"type": "git",
"url": "git+https://github.com/rowanwins/leaflet-easyPrint.git"
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Expand Up @@ -5,7 +5,8 @@ import uglify from 'rollup-plugin-uglify';

export default {
entry: 'src/main.js',
format: 'cjs',
format: 'umd',
moduleName: 'leaflet-easyprint',
plugins: [
resolve(),
babel({
Expand Down
15 changes: 9 additions & 6 deletions src/index.js
Expand Up @@ -48,10 +48,10 @@ L.Control.EasyPrint = L.Control.extend({
};
return sizeMode;
}, this);


var container = L.DomUtil.create('div', 'leaflet-control-easyPrint leaflet-bar leaflet-control');
if (!this.options.hidden) {
this._addCss();
var container = L.DomUtil.create('div', 'leaflet-control-easyPrint leaflet-bar leaflet-control');

L.DomEvent.addListener(container, 'mouseover', this._togglePageSizeButtons, this);
L.DomEvent.addListener(container, 'mouseout', this._togglePageSizeButtons, this);
Expand All @@ -72,9 +72,8 @@ L.Control.EasyPrint = L.Control.extend({
}, this);

L.DomEvent.disableClickPropagation(container);

return container;
}
return container;
},

printMap: function (event, filename) {
Expand All @@ -92,7 +91,9 @@ L.Control.EasyPrint = L.Control.extend({
center: this._map.getCenter()
};
this._map.fire("easyPrint-start", { event: event });
this._togglePageSizeButtons({type: null});
if (!this.options.hidden) {
this._togglePageSizeButtons({type: null});
}
if (this.options.hideControlContainer) {
this._toggleControls();
}
Expand Down Expand Up @@ -171,7 +172,9 @@ L.Control.EasyPrint = L.Control.extend({
} else {
plugin._sendToBrowserPrint(dataUrl, plugin.orientation);
}
plugin._toggleControls(true);
if (!plugin.options.hidden) {
plugin._toggleControls(true);
}

if (plugin.outerContainer) {
plugin.mapContainer.style.width = plugin.originalState.mapWidth;
Expand Down

0 comments on commit dc7455f

Please sign in to comment.