Using sans-serif instead of loaded fonts; fix IE9 dataset compatibility shim
This commit is contained in:
parent
7859ef0f04
commit
cdf1db35fc
@ -217,12 +217,15 @@
|
|||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
if ('dataset' in div)
|
if ('dataset' in div)
|
||||||
return; // dataset property exists
|
return; // dataset property exists
|
||||||
Object.defineProperty(HTMLElement.prototype, 'dataset', {
|
var oldCreateElement = document.createElement;
|
||||||
get: function htmlElementDatasetGetter() {
|
document.createElement = function newCreateElement() {
|
||||||
// adding dataset field to the actual object
|
var result = oldCreateElement.apply(document, arguments);
|
||||||
return (this.dataset = {});
|
if (arguments[0] === 'div') {
|
||||||
|
// creating dataset property for the div elements
|
||||||
|
result.dataset = {};
|
||||||
}
|
}
|
||||||
});
|
return result;
|
||||||
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Check console compatability
|
// Check console compatability
|
||||||
|
@ -252,6 +252,7 @@ canvas {
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.textLayer > div {
|
.textLayer > div {
|
||||||
|
@ -1083,7 +1083,6 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv) {
|
|||||||
textDiv.dataset.canvasWidth = text.canvasWidth * text.geom.hScale;
|
textDiv.dataset.canvasWidth = text.canvasWidth * text.geom.hScale;
|
||||||
|
|
||||||
textDiv.style.fontSize = fontHeight + 'px';
|
textDiv.style.fontSize = fontHeight + 'px';
|
||||||
textDiv.style.fontFamily = fontName || 'sans-serif';
|
|
||||||
textDiv.style.left = text.geom.x + 'px';
|
textDiv.style.left = text.geom.x + 'px';
|
||||||
textDiv.style.top = (text.geom.y - fontHeight) + 'px';
|
textDiv.style.top = (text.geom.y - fontHeight) + 'px';
|
||||||
textDiv.textContent = text.str;
|
textDiv.textContent = text.str;
|
||||||
|
Loading…
Reference in New Issue
Block a user