Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve css #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ TODO
- <del>Styling</del>
- <del>Prevent double-clicking prevent from zooming map</del>
- <del>Make panning offset configurable</del>
- Do something about the hardcoded support for the zoom- and zoomslider controls.
- <del>Do something about the hardcoded support for the zoom- and zoomslider controls.<del>
- <del>Make special CSS's for IE.</del>
7 changes: 5 additions & 2 deletions examples/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ var map = L.TileJSON.createMap('map', osmTileJSON, {
mapOptions: { zoomControl: false }
});

L.control.pan().addTo(map);
L.control.zoom().addTo(map);
var options = {
position: 'topleft'
};
L.control.pan(options).addTo(map);
L.control.zoom({ position: options.position }).addTo(map);
175 changes: 84 additions & 91 deletions src/L.Control.Pan.css
Original file line number Diff line number Diff line change
@@ -1,92 +1,74 @@
/* Make the default zoom control align with the pan control.

This is ugly.
The parent box (class="leaflet-top leaflet-left")
should make all the child boxes be center-aligned instead.
Not sure if that is possible though.
*/
.leaflet-left.has-leaflet-pan-control .leaflet-control-zoom {
position: relative;
left: 24px;
}
.leaflet-right.has-leaflet-pan-control .leaflet-control-zoom {
position: relative;
right: 24px;
}

/*
Make the zoomSlider control
(https://github.com/mattiasbengtsson/Leaflet.zoomslider)
align with the pan control.
*/
.leaflet-left.has-leaflet-pan-control .leaflet-control-zoomslider {
position: relative;
left: 22px;
}
.leaflet-right.has-leaflet-pan-control .leaflet-control-zoomslider {
position: relative;
right: 22px;
}

.leaflet-control-pan {
/*
.leaflet-control-pan-right-wrap: right
+ .leaflet-control-pan a: width
= 52 + 24 = 76
*/
width: 76px;
/*
.leaflet-control-pan-down-wrap: top
+ .leaflet-control-pan a: height
= 52 + 24 = 76
*/
height: 76px;
.leaflet-left.has-leaflet-pan-control {
left: 24.5px; /* (75-26)/2 */
}
.leaflet-right.has-leaflet-pan-control {
right: 24.5px;
}

.leaflet-control-pan > div {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
.leaflet-left.has-leaflet-pan-control .leaflet-control-scale {
left: -24.5px;
}
.leaflet-control-pan > div {
box-shadow: 0 1px 7px rgba(0,0,0,0.65);
.leaflet-right.has-leaflet-pan-control .leaflet-control-scale {
right: -24.5px;
}
.leaflet-control-pan a {
background-color: #fff;

.leaflet-left .leaflet-control-pan {
left: -24.5px;
}
.leaflet-control-pan a{
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
.leaflet-right .leaflet-control-pan {
right: -24.5px;
}

.leaflet-control-pan {
/*
.leaflet-control-pan-right-wrap: right
+ .leaflet-control-pan a: width
= 52 + 23 = 75
*/
width: 75px;
/*
.leaflet-control-pan-down-wrap: top
+ .leaflet-control-pan a: height
= 52 + 23 = 75
*/
height: 75px;
}

.leaflet-control-pan > div {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
box-shadow: 0 1px 7px rgba(0,0,0,0.65);
position: absolute;
}
.leaflet-control-pan a {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
width: 23px;
height: 23px;
background-color: #fff;
background-position: 50% 50%;
background-repeat: no-repeat;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
display: block;
width: 23px;
height: 23px;
}
.leaflet-control-pan a:hover {
background-color: #f4f4f4;
background-color: #f4f4f4;
}

.leaflet-control-pan-up-wrap {
position:absolute;
left:26px;
left: 26px;
}
.leaflet-control-pan-left-wrap {
position:absolute;
top:26px;
top: 26px;
}
.leaflet-control-pan-right-wrap {
position:absolute;
left:52px;
top:26px;
left: 52px;
top: 26px;
}
.leaflet-control-pan-down-wrap {
position:absolute;
left:26px;
top:52px;
left: 26px;
top: 52px;
}

.leaflet-control-pan-up {
Expand All @@ -103,45 +85,56 @@
}

/****** Touch Alterations ******/
.leaflet-touch .leaflet-control-pan div {
border: 2px solid rgba(0, 0, 0, 0.2);
box-shadow: none;
.leaflet-touch .leaflet-left.has-leaflet-pan-control {
left: 26px; /* (86-30)/2-2 */
}
.leaflet-touch .leaflet-right.has-leaflet-pan-control {
right: 26px;
}

.leaflet-touch .leaflet-left.has-leaflet-pan-control .leaflet-control-scale {
left: -26px;
}
.leaflet-touch .leaflet-right.has-leaflet-pan-control .leaflet-control-scale {
right: -26px;
}

border-radius: 4px;
.leaflet-touch .leaflet-left .leaflet-control-pan {
left: -26px;
}
.leaflet-touch .leaflet-right .leaflet-control-pan {
right: -26px;
}

.leaflet-touch .leaflet-control-pan {
width: 89px;
height: 119px;
margin-left: 8px;
width: 86px; /* 52+30+2*2 */
height: 114px;
}

.leaflet-touch .leaflet-right .leaflet-control-pan {
margin-left: 0;
margin-right: 5px;
.leaflet-touch .leaflet-control-pan div {
border: 2px solid rgba(0, 0, 0, 0.2);
box-shadow: none;
}

.leaflet-touch .leaflet-control-pan a {
width: 30px;
height: 30px;

border-radius: 4px;
width: 30px;
height: 30px;
}

.leaflet-touch .leaflet-control-pan-up-wrap {
left:26px;
left: 26px;
}

.leaflet-touch .leaflet-control-pan-left-wrap {
top:40px;
top: 40px;
}

.leaflet-touch .leaflet-control-pan-right-wrap {
left:52px;
top:40px;
left: 52px;
top: 40px;
}

.leaflet-touch .leaflet-control-pan-down-wrap {
left:26px;
top:80px;
left: 26px;
top: 80px;
}
33 changes: 16 additions & 17 deletions src/L.Control.Pan.ie.css
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@

.leaflet-control-pan > div {
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#3F000000',EndColorStr='#3F000000');
border: 3px solid #999;
border: 3px solid #999;
}
.leaflet-control-pan a {
background-color: #fff;
width: 17px;
height: 17px;
width: 17px;
height: 17px;
}
.leaflet-control-pan a:hover {
background-color: #f4f4f4;
background-color: #f4f4f4;
}

.leaflet-control-pan-up-wrap {
position:absolute;
left:27px;
position: absolute;
left: 27px;
}
.leaflet-control-pan-left-wrap {
position:absolute;
top:27px;
position: absolute;
top: 27px;
}
.leaflet-control-pan-right-wrap {
position:absolute;
left:54px;
top:27px;
position: absolute;
left: 54px;
top: 27px;
}
.leaflet-control-pan-down-wrap {
position:absolute;
left:27px;
top:54px;
position: absolute;
left: 27px;
top: 54px;
}

.leaflet-control-zoom {
left:23px;
left: 23px;
}
.leaflet-control-zoomslider {
position: relative;
left:23px;
left: 23px;
}