Skip to content

Commit

Permalink
move Safari hacks to CSS, do not optimize contrast in Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Jan 27, 2014
1 parent 9228b30 commit 187d9c2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
11 changes: 10 additions & 1 deletion dist/leaflet.css
Expand Up @@ -25,7 +25,16 @@
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
image-rendering:-webkit-optimize-contrast;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
Expand Down
5 changes: 3 additions & 2 deletions src/core/Browser.js
Expand Up @@ -12,6 +12,7 @@
webkit = ua.indexOf('webkit') !== -1,
phantomjs = ua.indexOf('phantom') !== -1,
android23 = ua.search('android [23]') !== -1,
chrome = ua.indexOf('chrome') !== -1,

mobile = typeof orientation !== 'undefined',
msPointer = navigator.msPointerEnabled && navigator.msMaxTouchPoints && !window.PointerEvent,
Expand Down Expand Up @@ -40,8 +41,8 @@
gecko: (ua.indexOf('gecko') !== -1) && !webkit && !window.opera && !ie,
android: ua.indexOf('android') !== -1,
android23: android23,
chrome: ua.indexOf('chrome') !== -1,
safari: ua.indexOf('safari') !== -1,
chrome: chrome,
safari: !chrome && ua.indexOf('safari') !== -1,

ie3d: ie3d,
webkit3d: webkit3d,
Expand Down
5 changes: 0 additions & 5 deletions src/layer/tile/GridLayer.js
Expand Up @@ -200,11 +200,6 @@ L.GridLayer = L.Layer.extend({
front.innerHTML = '';

// hack that prevents hw layers "stretching" when loading new tiles
if (this._zoomAnimated && L.Browser.safari) {
front.style.width = '1600px';
front.style.height = '1600px';
front.style.WebkitTransformOrigin = '0 0';
}

if (this._zoomAnimated && e && e.hard) {
this._clearBgBuffer();
Expand Down
1 change: 1 addition & 0 deletions src/map/Map.js
Expand Up @@ -435,6 +435,7 @@ L.Map = L.Evented.extend({
(L.Browser.touch ? ' leaflet-touch' : '') +
(L.Browser.retina ? ' leaflet-retina' : '') +
(L.Browser.ielt9 ? ' leaflet-oldie' : '') +
(L.Browser.safari ? ' leaflet-safari' : '') +
(this._fadeAnimated ? ' leaflet-fade-anim' : ''));

var position = L.DomUtil.getStyle(container, 'position');
Expand Down

0 comments on commit 187d9c2

Please sign in to comment.