Center label baseline hack for IE11, Edge

(closes #3020)
This commit is contained in:
Bryan Housel
2016-10-18 21:28:20 -04:00
parent a80b983c33
commit bf857c419a
3 changed files with 7 additions and 8 deletions
+3 -2
View File
@@ -1322,8 +1322,9 @@ text.pointlabel {
}
/* Opera doesn't support dominant-baseline. See #715 */
.opera .linelabel-halo .textpath,
.opera .linelabel .textpath {
/* Safari 10 seems to have regressed too */
.linelabel-halo .textpath,
.linelabel .textpath {
baseline-shift: -33%;
dominant-baseline: auto;
}
+3
View File
@@ -15,6 +15,8 @@ import { utilDisplayName, utilEntitySelector } from '../util/index';
export function svgLabels(projection, context) {
var path = d3.geoPath().projection(projection),
detected = utilDetect(),
baselineHack = (detected.ie || detected.browser.toLowerCase() === 'edge'),
rdrawn = rbush(),
rskipped = rbush(),
textWidthCache = {},
@@ -119,6 +121,7 @@ export function svgLabels(projection, context) {
texts.enter()
.append('text')
.attr('class', function(d, i) { return classes + ' ' + labels[i].classes + ' ' + d.id; })
.attr('dy', baselineHack ? '0.35em' : null)
.append('textPath')
.attr('class', 'textpath');
+1 -6
View File
@@ -2,12 +2,11 @@ import * as d3 from 'd3';
import { d3keybinding } from '../lib/d3.keybinding.js';
import { t, textDirection } from '../util/locale';
import { tooltip } from '../util/tooltip';
import { utilDetect } from '../util/detect';
import { utilSetDimensions } from '../util/dimensions';
import { svgDefs, svgIcon } from '../svg/index';
import { modeBrowse } from '../modes/index';
import { behaviorHash } from '../behavior/index';
import { utilSetDimensions } from '../util/dimensions';
import { uiAccount } from './account';
import { uiAttribution } from './attribution';
@@ -39,10 +38,6 @@ export function uiInit(context) {
function render(container) {
var map = context.map();
if (utilDetect().opera) {
container.classed('opera', true);
}
var hash = behaviorHash(context);
hash();