Merge pull request #1099 from danzel/rtl

RTL improvements. Fixes #1095
This commit is contained in:
Vladimir Agafonkin 2012-10-28 14:28:46 -07:00
commit 13d06fccf6
2 changed files with 11 additions and 3 deletions

1
dist/leaflet.css vendored
View File

@ -14,6 +14,7 @@
.leaflet-image-layer,
.leaflet-layer { /* TODO optimize classes */
position: absolute;
left: 0;
}
.leaflet-container {
overflow: hidden;

View File

@ -32,7 +32,7 @@ L.DomUtil = {
pos;
do {
top += el.offsetTop || 0;
top += el.offsetTop || 0;
left += el.offsetLeft || 0;
pos = L.DomUtil.getStyle(el, 'position');
@ -52,8 +52,15 @@ L.DomUtil = {
do {
if (el === docBody) { break; }
top -= el.scrollTop || 0;
left -= el.scrollLeft || 0;
top -= el.scrollTop || 0;
//See https://developer.mozilla.org/en-US/docs/DOM/element.scrollLeft
// http://www.nczonline.net/blog/2010/08/03/working-with-bidirectional-bidi-text-and-rtl-languages-on-the-web/
if (L.DomUtil.getStyle(el, 'direction') == "ltr") {
left -= el.scrollLeft || 0;
} else {
left -= (el.scrollLeft || 0) - el.scrollWidth + el.clientWidth;
}
el = el.parentNode;
} while (el);