Merge branch 'master' of github.com:konvajs/konva

This commit is contained in:
Anton Lavrenov
2019-01-19 10:13:43 -05:00
3 changed files with 4 additions and 5 deletions

View File

@@ -143,10 +143,10 @@ export abstract class Node {
// if not cached, we need to set it using the private getter method. // if not cached, we need to set it using the private getter method.
if (cache === undefined) { if (cache === undefined) {
this._cache[attr] = privateGetter.call(this); this._cache[attr] = cache = privateGetter.call(this);
} }
return this._cache[attr]; return cache;
} }
/* /*
* when the logic for a cached result depends on ancestor propagation, use this * when the logic for a cached result depends on ancestor propagation, use this

View File

@@ -159,8 +159,7 @@ export class Text extends Shape {
} }
if (padding) { if (padding) {
context.translate(padding, 0); context.translate(padding, alignY + padding + lineHeightPx / 2);
context.translate(0, alignY + padding + lineHeightPx / 2);
} else { } else {
context.translate(0, alignY + lineHeightPx / 2); context.translate(0, alignY + lineHeightPx / 2);
} }

View File

@@ -653,7 +653,7 @@ suite('Text', function() {
stage.add(layer); stage.add(layer);
var trace = var trace =
'clearRect(0,0,578,200);save();transform(1,0,0,1,10,10);beginPath();rect(0,0,200,100);closePath();lineWidth=2;strokeStyle=black;stroke();restore();save();transform(1,0,0,1,10,10);font=normal normal 16px Arial;textBaseline=middle;textAlign=left;translate(10,0);translate(0,50);save();translate(17.523,0);fillStyle=#555;fillText(Some awesome text,0,0);restore();restore();'; 'clearRect(0,0,578,200);save();transform(1,0,0,1,10,10);beginPath();rect(0,0,200,100);closePath();lineWidth=2;strokeStyle=black;stroke();restore();save();transform(1,0,0,1,10,10);font=normal normal 16px Arial;textBaseline=middle;textAlign=left;translate(10,50);save();translate(17.523,0);fillStyle=#555;fillText(Some awesome text,0,0);restore();restore();';
assert.equal(layer.getContext().getTrace(), trace); assert.equal(layer.getContext().getTrace(), trace);
}); });