mirror of
https://github.com/konvajs/konva.git
synced 2026-01-08 18:54:40 +08:00
Minor improvement to the implementation of Text._sceneFunc
As the context's translate() is additive, there is no need for the two consecutive calls of it inside _sceneFunc(): The same effect can be achieved with with just one call of translate(). A corresponding update was done in the unit test for Text that had a pair of calls to translate() in the expected call dump.
This commit is contained in:
@@ -159,8 +159,7 @@ export class Text extends Shape {
|
||||
}
|
||||
|
||||
if (padding) {
|
||||
context.translate(padding, 0);
|
||||
context.translate(0, alignY + padding + lineHeightPx / 2);
|
||||
context.translate(padding, alignY + padding + lineHeightPx / 2);
|
||||
} else {
|
||||
context.translate(0, alignY + lineHeightPx / 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user