Fix AppendText after API changes
This commit is contained in:
parent
a33ba145bf
commit
e48530d391
@ -793,7 +793,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
if (textSelection) {
|
||||
geom.canvasWidth = canvasWidth;
|
||||
this.textLayer.appendText(font.fallbackName, fontSize, geom);
|
||||
}`
|
||||
}
|
||||
|
||||
return canvasWidth;
|
||||
},
|
||||
|
@ -168,23 +168,23 @@ SimpleTextLayerBuilder.prototype = {
|
||||
endLayout: function SimpleTextLayerBuilder_EndLayout() {
|
||||
this.ctx.restore();
|
||||
},
|
||||
appendText: function SimpleTextLayerBuilder_AppendText(text, fontName,
|
||||
fontSize) {
|
||||
appendText: function SimpleTextLayerBuilder_AppendText(fontName, fontSize,
|
||||
geom) {
|
||||
var ctx = this.ctx, viewport = this.viewport;
|
||||
// vScale and hScale already contain the scaling to pixel units
|
||||
var fontHeight = fontSize * text.geom.vScale;
|
||||
var fontHeight = fontSize * geom.vScale;
|
||||
ctx.beginPath();
|
||||
ctx.strokeStyle = 'red';
|
||||
ctx.fillStyle = 'yellow';
|
||||
ctx.rect(text.geom.x, text.geom.y - fontHeight,
|
||||
text.canvasWidth * text.geom.hScale, fontHeight);
|
||||
ctx.rect(geom.x, geom.y - fontHeight,
|
||||
geom.canvasWidth * geom.hScale, fontHeight);
|
||||
ctx.stroke();
|
||||
ctx.fill();
|
||||
|
||||
var textContent = this.textContent.text[this.textCounter];
|
||||
ctx.font = fontHeight + 'px ' + fontName;
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.fillText(textContent, text.geom.x, text.geom.y);
|
||||
ctx.fillText(textContent, geom.x, geom.y);
|
||||
|
||||
this.textCounter++;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user