Skip to content

Commit 5fbd0c1

Browse files
committed
Rename Paragraph Enums for better consistency
1 parent 6001892 commit 5fbd0c1

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

package/src/renderer/__tests__/e2e/Paragraphs.spec.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
} from "../../../__tests__/setup";
88
import {
99
FontStyle,
10-
SkTextAlign,
11-
SkTextDirection,
10+
TextAlign,
11+
TextDirection,
1212
TextDecoration,
1313
} from "../../../skia/types";
1414

@@ -216,7 +216,7 @@ describe("Paragraphs", () => {
216216
para.layout(width);
217217
para.paint(canvas, 0, 0);
218218
},
219-
{ width: surface.width, textAlign: SkTextAlign.Right }
219+
{ width: surface.width, textAlign: TextAlign.Right }
220220
);
221221
checkImage(
222222
img,
@@ -236,7 +236,7 @@ describe("Paragraphs", () => {
236236
para.layout(width);
237237
para.paint(canvas, 0, 0);
238238
},
239-
{ width: surface.width, textAlign: SkTextAlign.Center }
239+
{ width: surface.width, textAlign: TextAlign.Center }
240240
);
241241
checkImage(
242242
img,
@@ -260,7 +260,7 @@ describe("Paragraphs", () => {
260260
para.layout(width);
261261
para.paint(canvas, 0, 0);
262262
},
263-
{ textAlign: SkTextAlign.Justify, width: surface.width }
263+
{ textAlign: TextAlign.Justify, width: surface.width }
264264
);
265265
checkImage(
266266
img,
@@ -284,7 +284,7 @@ describe("Paragraphs", () => {
284284
para.layout(width);
285285
para.paint(canvas, 0, 0);
286286
},
287-
{ width: surface.width, textAlign: SkTextAlign.Justify }
287+
{ width: surface.width, textAlign: TextAlign.Justify }
288288
);
289289
checkImage(
290290
img,
@@ -306,7 +306,7 @@ describe("Paragraphs", () => {
306306
para.layout(150);
307307
para.paint(canvas, 0, 0);
308308
},
309-
{ textDirection: SkTextDirection.RTL }
309+
{ textDirection: TextDirection.RTL }
310310
);
311311
checkImage(
312312
img,

package/src/skia/types/Paragraph/Paragraph.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import type { SkCanvas } from "../Canvas";
22
import type { SkJSIInstance } from "../JsiInstance";
33
import type { SkRect } from "../Rect";
44

5-
import type { SkTextDirection } from "./ParagraphStyle";
5+
import type { TextDirection } from "./ParagraphStyle";
66

77
export interface SkRectWithDirection {
88
rect: SkRect;
9-
direction: SkTextDirection;
9+
direction: TextDirection;
1010
}
1111

1212
export interface SkParagraph extends SkJSIInstance<"Paragraph"> {

package/src/skia/types/Paragraph/ParagraphStyle.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { SkTextFontStyle, SkTextStyle } from "./TextStyle";
22

3-
export enum SkTextDirection {
3+
export enum TextDirection {
44
RTL = 0,
55
LTR = 1,
66
}
7-
export enum SkTextAlign {
7+
export enum TextAlign {
88
Left = 0,
99
Right,
1010
Center,
@@ -24,7 +24,7 @@ export interface SkStrutStyle {
2424
forceStrutHeight?: boolean;
2525
}
2626

27-
export enum SkTextHeightBehavior {
27+
export enum TextHeightBehavior {
2828
All = 0x0,
2929
DisableFirstAscent = 0x1,
3030
DisableLastDescent = 0x2,
@@ -38,8 +38,8 @@ export interface SkParagraphStyle {
3838
maxLines?: number;
3939
replaceTabCharacters?: boolean;
4040
strutStyle?: SkStrutStyle;
41-
textAlign?: SkTextAlign;
42-
textDirection?: SkTextDirection;
43-
textHeightBehavior?: SkTextHeightBehavior;
41+
textAlign?: TextAlign;
42+
textDirection?: TextDirection;
43+
textHeightBehavior?: TextHeightBehavior;
4444
textStyle?: SkTextStyle;
4545
}

package/src/skia/web/JsiSkParagraphStyle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CanvasKit, ParagraphStyle } from "canvaskit-wasm";
22

3-
import { SkTextDirection, type SkParagraphStyle } from "../types";
3+
import { TextDirection, type SkParagraphStyle } from "../types";
44

55
export class JsiSkParagraphStyle {
66
static toParagraphStyle(
@@ -23,7 +23,7 @@ export class JsiSkParagraphStyle {
2323
: undefined ?? ps.textAlign;
2424
ps.textDirection =
2525
value.textDirection !== undefined
26-
? { value: value.textDirection === SkTextDirection.LTR ? 1 : 0 }
26+
? { value: value.textDirection === TextDirection.LTR ? 1 : 0 }
2727
: ps.textDirection;
2828
ps.textHeightBehavior =
2929
value.textHeightBehavior !== undefined

0 commit comments

Comments
 (0)