Skip to content

Commit bb57f58

Browse files
committed
style: minor cleanup and comments
1 parent a00c71c commit bb57f58

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/renderer/cat/cat_face.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const setVisibility = (element: SVGElement, visible: boolean) => {
3232

3333
/**
3434
* Manages the SVG elements for the cat face.
35-
* This class holds the persistent SVG elements and manages events (blinking, etc.),
36-
* but layout is driven by the Drawer/RenderInfo.
35+
* This class holds the persistent SVG elements and manages events (blinking, etc.)
36+
* Owned by the PathObject with similar lifetime.
3737
*/
3838
export class CatFace {
3939
faceGroup_: SVGElement;
@@ -43,9 +43,7 @@ export class CatFace {
4343
renderer_: CatScratchRenderer;
4444
block_: Blockly.BlockSvg;
4545

46-
constructor(
47-
info: RenderInfo,
48-
) {
46+
constructor(info: RenderInfo) {
4947
this.constants_ = info.constants_;
5048
this.renderer_ = info.renderer_;
5149
this.block_ = info.block_;
@@ -99,6 +97,11 @@ export class CatFace {
9997
});
10098
}
10199

100+
/**
101+
* Asks the renderer to re-render the block at a time when it normally wouldn't.
102+
* Necessary if the path geometry has changed (ear flicks).
103+
* Not necessary for face changes (blinking).
104+
*/
102105
private triggerRedraw() {
103106
this.renderer_.render(this.block_);
104107
}

src/renderer/cat/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export enum PathEarState {
1818

1919
export interface CatPathState {
2020
capType: PathCapType;
21-
ear1State: PathEarState;
22-
ear2State: PathEarState;
21+
ear1State: PathEarState; // Left ear in LTR, right in RTL
22+
ear2State: PathEarState; // Right ear in LTR, left in RTL
2323
}
2424

2525
export class ConstantProvider extends ClassicConstantProvider {

0 commit comments

Comments
 (0)