Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xkxx committed Sep 20, 2023
1 parent ddba4d6 commit 6a5fc52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/Context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ var COMMA = ',',
'strokeText',
'transform',
'translate',
'trySetLetterSpacing',
];

var CONTEXT_PROPERTIES = [
Expand Down
7 changes: 5 additions & 2 deletions src/shapes/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface TextConfig extends ShapeConfig {
var AUTO = 'auto',
//CANVAS = 'canvas',
CENTER = 'center',
INHERIT = 'inherit',
JUSTIFY = 'justify',
CHANGE_KONVA = 'Change.konva',
CONTEXT_2D = '2d',
Expand Down Expand Up @@ -136,7 +137,7 @@ function checkDefaultFill(config?: TextConfig) {
* @memberof Konva
* @augments Konva.Shape
* @param {Object} config
* @param {String} [config.direction] default is ltr
* @param {String} [config.direction] default is inherit
* @param {String} [config.fontFamily] default is Arial
* @param {Number} [config.fontSize] in pixels. Default is 12
* @param {String} [config.fontStyle] can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default.
Expand Down Expand Up @@ -200,6 +201,8 @@ export class Text extends Shape<TextConfig> {
shouldUnderline = textDecoration.indexOf('underline') !== -1,
shouldLineThrough = textDecoration.indexOf('line-through') !== -1,
n;

direction = direction === INHERIT ? context.direction : direction;

var translateY = 0;
var translateY = lineHeightPx / 2;
Expand Down Expand Up @@ -714,7 +717,7 @@ Factory.overWriteSetter(Text, 'height', getNumberOrAutoValidator());
* // set direction
* text.direction('rtl');
*/
Factory.addGetterSetter(Text, 'direction', 'ltr');
Factory.addGetterSetter(Text, 'direction', INHERIT);

/**
* get/set font family
Expand Down

0 comments on commit 6a5fc52

Please sign in to comment.