Skip to content

Commit

Permalink
external: Control.MiniMap.js update to 30eff5568645bf2bdab86b9e2d8fa6…
Browse files Browse the repository at this point in the history
…b459a33966 (v3.6.1-4-gf5bfff8)

Control.MiniMap.css
Control.MiniMap.js
images/
  toggle.png
  toggle.svg

plugin minimap: use @@INCLUDECSS macro
  • Loading branch information
johndoe committed Apr 8, 2019
1 parent 2d37acb commit 0deb1d4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions external/Control.MiniMap.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
}

.leaflet-control-minimap-toggle-display{
background-image: url(@@INCLUDEIMAGE:images/minimap-toggle.png@@);
background-image: url("images/toggle.svg");
background-size: cover;
position: absolute;
border-radius: 3px 0px 0px 0px;
}

.leaflet-oldie .leaflet-control-minimap-toggle-display{
background-image: url(@@INCLUDEIMAGE:images/minimap-toggle.png@@);
background-image: url("images/toggle.png");
}

.leaflet-control-minimap-toggle-display-bottomright {
Expand Down
21 changes: 21 additions & 0 deletions external/Control.MiniMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}(function (L) {

var MiniMap = L.Control.extend({

includes: L.Evented ? L.Evented.prototype : L.Mixin.Events,

options: {
position: 'bottomright',
toggleDisplay: false,
Expand Down Expand Up @@ -190,6 +193,7 @@
this._container.style.display = 'none';
}
this._minimized = true;
this._onToggle();
},

_restore: function () {
Expand All @@ -203,6 +207,7 @@
this._container.style.display = 'block';
}
this._minimized = false;
this._onToggle();
},

_onMainMapMoved: function (e) {
Expand Down Expand Up @@ -313,6 +318,22 @@

_isDefined: function (value) {
return typeof value !== 'undefined';
},

_onToggle: function () {
L.Util.requestAnimFrame(function () {
L.DomEvent.on(this._container, 'transitionend', this._fireToggleEvents, this);
if (!L.Browser.any3d) {
L.Util.requestAnimFrame(this._fireToggleEvents, this);
}
}, this);
},

_fireToggleEvents: function () {
L.DomEvent.off(this._container, 'transitionend', this._fireToggleEvents, this);
var data = { minimized: this._minimized };
this.fire(this._minimized ? 'minimize' : 'restore', data);
this.fire('toggle', data);
}
});

Expand Down
Binary file removed images/minimap-toggle.png
Binary file not shown.
Binary file added images/toggle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
4 changes: 2 additions & 2 deletions plugins/minimap.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @id iitc-plugin-minimap@breunigs
// @name IITC plugin: Mini map
// @category Controls
// @version 0.2.0.@@DATETIMEVERSION@@
// @version 0.3.0.@@DATETIMEVERSION@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Show a mini map on the corner of the map.
@@METAINFO@@
// ==/UserScript==
Expand Down Expand Up @@ -32,7 +32,7 @@ window.plugin.miniMap.setup = function() {
new L.Control.MiniMap(L.gridLayer.googleMutant('ROADMAP',{maxZoom:21}), {toggleDisplay: true, position: position}).addTo(window.map);
}, 0);

$('head').append('<style>@@INCLUDESTRING:external/Control.MiniMap.css@@</style>');
$('head').append('<style>@@INCLUDECSS:external/Control.MiniMap.css@@</style>');
};

var setup = window.plugin.miniMap.setup;
Expand Down

0 comments on commit 0deb1d4

Please sign in to comment.