Merge pull request #7130 from nschloe/patch-1
Add element to text layer even if width === 0
This commit is contained in:
commit
3d49879211
@ -156,23 +156,21 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var width = ctx.measureText(textDiv.textContent).width;
|
var width = ctx.measureText(textDiv.textContent).width;
|
||||||
if (width > 0) {
|
textLayerFrag.appendChild(textDiv);
|
||||||
textLayerFrag.appendChild(textDiv);
|
var transform;
|
||||||
var transform;
|
if (textDiv.dataset.canvasWidth !== undefined && width > 0) {
|
||||||
if (textDiv.dataset.canvasWidth !== undefined) {
|
// Dataset values come of type string.
|
||||||
// Dataset values come of type string.
|
var textScale = textDiv.dataset.canvasWidth / width;
|
||||||
var textScale = textDiv.dataset.canvasWidth / width;
|
transform = 'scaleX(' + textScale + ')';
|
||||||
transform = 'scaleX(' + textScale + ')';
|
} else {
|
||||||
} else {
|
transform = '';
|
||||||
transform = '';
|
}
|
||||||
}
|
var rotation = textDiv.dataset.angle;
|
||||||
var rotation = textDiv.dataset.angle;
|
if (rotation) {
|
||||||
if (rotation) {
|
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
||||||
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
}
|
||||||
}
|
if (transform) {
|
||||||
if (transform) {
|
CustomStyle.setProp('transform' , textDiv, transform);
|
||||||
CustomStyle.setProp('transform' , textDiv, transform);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
capability.resolve();
|
capability.resolve();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user