Skip to content

Commit

Permalink
Update CEA cue positioning:
Browse files Browse the repository at this point in the history
- vertically position region/row (absolute)
- horizontally position cue itself (not abs.)
  • Loading branch information
felix-hoc committed Jan 7, 2025
1 parent 19d34aa commit afcfa82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/scss/skin-modern/components/_subtitleoverlay-cea608.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
right: 3em;
top: 2em;

.#{$prefix}-subtitle-region-container.#{$prefix}-subtitle-position-default {
bottom: 0;
.#{$prefix}-subtitle-region-container {
left: 0;

Check warning on line 10 in src/scss/skin-modern/components/_subtitleoverlay-cea608.scss

View workflow job for this annotation

GitHub Actions / test_and_build

Expected `height`, found `left`
right: 0;

Check warning on line 11 in src/scss/skin-modern/components/_subtitleoverlay-cea608.scss

View workflow job for this annotation

GitHub Actions / test_and_build

Expected `left`, found `right`
top: 0;
height: calc(100% / 15);
text-align: left;
line-height: 1em;
}

.#{$prefix}-ui-subtitle-label {
font-family: 'Courier New', Courier, 'Nimbus Mono L', 'Cutive Mono', monospace;
line-height: 1em;
position: absolute;
//line-height: 1em;
//position: absolute;
text-transform: uppercase;
display: inline-block;

// sass-lint:disable force-pseudo-nesting nesting-depth
&:nth-child(1n-1)::after {
Expand Down
12 changes: 10 additions & 2 deletions src/ts/components/subtitleoverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ export class SubtitleOverlay extends Container<ContainerConfig> {
'font-size': `${fontSize}px`,
'letter-spacing': `${fontLetterSpacing}px`,
});

// TODO set top and line-height on region
// label.regionStyle = `font-size: ${fontSize}px;`;
}
}
};
Expand Down Expand Up @@ -325,11 +328,12 @@ export class SubtitleOverlay extends Container<ContainerConfig> {
}

label.getDomElement().css({
'left': `${event.position.column * SubtitleOverlay.CEA608_COLUMN_OFFSET}%`,
'top': `${event.position.row * SubtitleOverlay.CEA608_ROW_OFFSET}%`,
'margin-left': `${event.position.column * SubtitleOverlay.CEA608_COLUMN_OFFSET}%`,
'font-size': `${fontSize}px`,
'letter-spacing': `${fontLetterSpacing}px`,
});

label.regionStyle = `line-height: ${fontSize}px; top: ${event.position.row * SubtitleOverlay.CEA608_ROW_OFFSET}%;`;
});

const reset = () => {
Expand Down Expand Up @@ -404,6 +408,10 @@ export class SubtitleLabel extends Label<SubtitleLabelConfig> {
get regionStyle(): string {
return this.config.regionStyle;
}

set regionStyle(style: string) {
this.config.regionStyle = style;
}
}

class ActiveSubtitleManager {
Expand Down

0 comments on commit afcfa82

Please sign in to comment.