Workarounds for IE
This commit is contained in:
parent
355bc28db0
commit
3281952c0a
2 changed files with 16 additions and 8 deletions
|
@ -51,7 +51,7 @@ def describeArc(x, y, radius, startAngle, endAngle):
|
|||
largeArcFlag = "0" if endAngle - startAngle <= 180 else "1";
|
||||
|
||||
d = " ".join([
|
||||
"M", start['x'], start['y'],
|
||||
"M", start['x'], str(round(float(start['y']) - 0.0001,4)), # make sure we don't get crazy small number IE cannot handle
|
||||
"A", str(radius), str(radius), "0", largeArcFlag, "0", end['x'], end['y']
|
||||
]);
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@
|
|||
|
||||
#detail{
|
||||
position:absolute;
|
||||
width:20em;
|
||||
margin-left:-10em;
|
||||
width:15em;
|
||||
margin-left:-7.5em;
|
||||
background:rgba(0,0,0,0.8);
|
||||
border-radius: 1em;
|
||||
display: none;
|
||||
|
@ -277,10 +277,11 @@
|
|||
{
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = evt.target.response;
|
||||
// document.getElementById('colourImage').innerHTML = div.children[0].innerHTML;
|
||||
// document.getElementById('colourImage').innerHTML = div.children[0].innerHTML; // this doesn't work in bloody IE!!
|
||||
document.getElementById('works').innerHTML = div.children[1].innerHTML;
|
||||
document.getElementById('stats').innerHTML = div.children[2].innerHTML;
|
||||
|
||||
// workaround for IE:
|
||||
let svgEl = document.getElementById('colourImage');
|
||||
svgEl.parentNode.replaceChild(div.children[0], svgEl);
|
||||
|
||||
|
@ -332,22 +333,29 @@
|
|||
|
||||
loadResults("no", "thing");
|
||||
|
||||
// workaround IE: https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY
|
||||
var supportPageOffset = window.pageXOffset !== undefined;
|
||||
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
|
||||
|
||||
function triggerover(layerId, el)
|
||||
{
|
||||
// workaround IE for window.scrollY: https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY
|
||||
// let x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
|
||||
let scrollY = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
|
||||
|
||||
let url = '/images/'+layerId+'.png';
|
||||
let position = el.getBoundingClientRect();
|
||||
let detailEl = document.getElementById('detail');
|
||||
document.getElementById('detail-img').src = url;
|
||||
|
||||
|
||||
el.onmouseout = triggerout;
|
||||
// show below icon if higher item, otherwise above it.
|
||||
if(el.attributes.cy.value <= 0) {
|
||||
detailEl.style.top = (position.top + position.height + window.scrollY) + 'px';
|
||||
detailEl.style.top = (position.top + position.height + scrollY) + 'px';
|
||||
detailEl.style.bottom = 'auto';
|
||||
} else {
|
||||
detailEl.style.top = 'auto';
|
||||
detailEl.style.bottom = 'calc(100% - ' + ( position.top + window.scrollY ) + 'px)';
|
||||
detailEl.style.bottom = 'calc(100% - ' + ( position.top + scrollY ) + 'px)';
|
||||
}
|
||||
detailEl.style.left = (position.left - position.width/2) + 'px';
|
||||
detailEl.classList.add('active');
|
||||
|
|
Loading…
Reference in a new issue