added getStyle, fixed setPosition
This commit is contained in:
parent
391e57c144
commit
ad46474275
@ -18,19 +18,20 @@
|
|||||||
<script type="text/javascript" src="../src/core/Util.js"></script>
|
<script type="text/javascript" src="../src/core/Util.js"></script>
|
||||||
<script type="text/javascript" src="../src/core/Class.js"></script>
|
<script type="text/javascript" src="../src/core/Class.js"></script>
|
||||||
<script type="text/javascript" src="../src/core/Events.js"></script>
|
<script type="text/javascript" src="../src/core/Events.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/core/Browser.js"></script>
|
||||||
|
|
||||||
<!-- /geometry -->
|
<!-- /dom -->
|
||||||
<script type="text/javascript" src="../src/geometry/Point.js"></script>
|
<script type="text/javascript" src="../src/dom/DomEvent.js"></script>
|
||||||
<script type="text/javascript" src="../src/geometry/Bounds.js"></script>
|
<script type="text/javascript" src="../src/dom/DomUtil.js"></script>
|
||||||
<script type="text/javascript" src="../src/geometry/Transformation.js"></script>
|
|
||||||
|
|
||||||
<!-- /geo -->
|
<!-- /geo -->
|
||||||
<script type="text/javascript" src="../src/geo/LatLng.js"></script>
|
<script type="text/javascript" src="../src/geo/LatLng.js"></script>
|
||||||
<script type="text/javascript" src="../src/geo/Projection.js"></script>
|
<script type="text/javascript" src="../src/geo/Projection.js"></script>
|
||||||
|
|
||||||
<!-- /dom -->
|
<!-- /geometry -->
|
||||||
<script type="text/javascript" src="../src/dom/DomEvent.js"></script>
|
<script type="text/javascript" src="../src/geometry/Point.js"></script>
|
||||||
<script type="text/javascript" src="../src/dom/DomUtil.js"></script>
|
<script type="text/javascript" src="../src/geometry/Bounds.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/geometry/Transformation.js"></script>
|
||||||
|
|
||||||
<!-- spec files -->
|
<!-- spec files -->
|
||||||
|
|
||||||
|
@ -24,4 +24,6 @@ describe('DomUtil', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#setPosition', noSpecs);
|
describe('#setPosition', noSpecs);
|
||||||
|
|
||||||
|
describe('#getStyle', noSpecs);
|
||||||
});
|
});
|
@ -7,6 +7,18 @@ L.DomUtil = {
|
|||||||
return (typeof id == 'string' ? document.getElementById(id) : id);
|
return (typeof id == 'string' ? document.getElementById(id) : id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getStyle: function(el, style) {
|
||||||
|
var value = el.style[style];
|
||||||
|
if ((typeof value == 'undefined') && el.currentStyle) {
|
||||||
|
value = el.currentStyle[style];
|
||||||
|
}
|
||||||
|
if (typeof value == 'undefined') {
|
||||||
|
var css = document.defaultView.getComputedStyle(el, null);
|
||||||
|
value = css ? css[style] : null;
|
||||||
|
}
|
||||||
|
return (value == 'auto' ? null : value);
|
||||||
|
},
|
||||||
|
|
||||||
getCumulativeOffset: function(el) {
|
getCumulativeOffset: function(el) {
|
||||||
var top = 0,
|
var top = 0,
|
||||||
left = 0;
|
left = 0;
|
||||||
@ -23,8 +35,8 @@ L.DomUtil = {
|
|||||||
if (L.Browser.webkit) {
|
if (L.Browser.webkit) {
|
||||||
el.style.webkitTransform = 'translate(' + point.x + 'px,' + point.y + 'px)';
|
el.style.webkitTransform = 'translate(' + point.x + 'px,' + point.y + 'px)';
|
||||||
} else {
|
} else {
|
||||||
el.style.left = point.x;
|
el.style.left = point.x + 'px';
|
||||||
el.style.top = point.y;
|
el.style.top = point.y + 'px';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPosition: function(el) {
|
getPosition: function(el) {
|
||||||
|
Loading…
Reference in New Issue
Block a user