Fix AppendText after API changes

This commit is contained in:
Julian Viereck 2012-09-20 21:48:18 +02:00
parent a33ba145bf
commit e48530d391
2 changed files with 7 additions and 7 deletions

View File

@ -793,7 +793,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
if (textSelection) { if (textSelection) {
geom.canvasWidth = canvasWidth; geom.canvasWidth = canvasWidth;
this.textLayer.appendText(font.fallbackName, fontSize, geom); this.textLayer.appendText(font.fallbackName, fontSize, geom);
}` }
return canvasWidth; return canvasWidth;
}, },

View File

@ -168,23 +168,23 @@ SimpleTextLayerBuilder.prototype = {
endLayout: function SimpleTextLayerBuilder_EndLayout() { endLayout: function SimpleTextLayerBuilder_EndLayout() {
this.ctx.restore(); this.ctx.restore();
}, },
appendText: function SimpleTextLayerBuilder_AppendText(text, fontName, appendText: function SimpleTextLayerBuilder_AppendText(fontName, fontSize,
fontSize) { geom) {
var ctx = this.ctx, viewport = this.viewport; var ctx = this.ctx, viewport = this.viewport;
// vScale and hScale already contain the scaling to pixel units // vScale and hScale already contain the scaling to pixel units
var fontHeight = fontSize * text.geom.vScale; var fontHeight = fontSize * geom.vScale;
ctx.beginPath(); ctx.beginPath();
ctx.strokeStyle = 'red'; ctx.strokeStyle = 'red';
ctx.fillStyle = 'yellow'; ctx.fillStyle = 'yellow';
ctx.rect(text.geom.x, text.geom.y - fontHeight, ctx.rect(geom.x, geom.y - fontHeight,
text.canvasWidth * text.geom.hScale, fontHeight); geom.canvasWidth * geom.hScale, fontHeight);
ctx.stroke(); ctx.stroke();
ctx.fill(); ctx.fill();
var textContent = this.textContent.text[this.textCounter]; var textContent = this.textContent.text[this.textCounter];
ctx.font = fontHeight + 'px ' + fontName; ctx.font = fontHeight + 'px ' + fontName;
ctx.fillStyle = 'black'; ctx.fillStyle = 'black';
ctx.fillText(textContent, text.geom.x, text.geom.y); ctx.fillText(textContent, geom.x, geom.y);
this.textCounter++; this.textCounter++;
}, },