Merge pull request #203 from tyrasd/upstream

Dragging still buggy with Opera 12.10. Also, support3d is always false.
This commit is contained in:
Tom MacWright
2012-12-06 06:29:09 -08:00
2 changed files with 19 additions and 6 deletions
+13 -2
View File
@@ -53,8 +53,19 @@ iD.Map = function() {
class_fill = iD.Style.styleClasses('stroke'),
class_area = iD.Style.styleClasses('area'),
class_casing = iD.Style.styleClasses('casing'),
transformProp = iD.util.prefix() + 'transform',
support3d = iD.util.prefix() === 'O',
transformProp = iD.util.prefixProperty('Transform'),
support3d = (function() {
// test for translate3d support. Based on https://gist.github.com/3794226 by lorenzopolidori and webinista
var el = document.createElement('div'),
has3d = false;
document.body.insertBefore(el,null);
if (el.style[transformProp] !== undefined) {
el.style[transformProp] = 'translate3d(1px,1px,1px)';
has3d = window.getComputedStyle(el).getPropertyValue(transformProp);
}
document.body.removeChild(el);
return (has3d && has3d.length>0 && has3d!=="none");
})(),
supersurface, surface, defs, tilegroup, r, g, alength;
function map() {
+6 -4
View File
@@ -64,12 +64,14 @@ iD.util.qsString = function(obj) {
}).join('&');
};
iD.util.prefix = function() {
iD.util.prefixProperty = function(property) {
var prefixes = ['webkit', 'ms', 'Moz', 'O'];
return (function prefixMatch(p) { // via mbostock
var i = -1, n = p.length, s = document.body.style;
while (++i < n) if (p[i] + 'Transform' in s) return '-' + p[i].toLowerCase() + '-';
return '';
})(['webkit', 'ms', 'Moz', 'O']);
if (property.toLowerCase() in s) return property.toLowerCase();
while (++i < n) if (p[i] + property in s) return '-' + p[i].toLowerCase() + '-' + property.toLowerCase();
return false;
})(prefixes);
};
iD.util.geo = {};