Skip to content

Commit

Permalink
Merge pull request #677 from bitmovin/feature/remove-seekbar-label-caret
Browse files Browse the repository at this point in the history
Remove the caret from the `SeekbarLabel`
  • Loading branch information
stonko1994 authored Jan 14, 2025
2 parents f1a05ec + 0429da0 commit c68eb5c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 46 deletions.
24 changes: 0 additions & 24 deletions spec/components/labels/SeekbarLabel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ describe('SeekBarLabel', () => {
} as DOMRect;

let containerGetDomElementMock: () => jest.Mocked<DOM>;
let caretGetDomElementMock: () => jest.Mocked<DOM>;

beforeEach(() => {
containerGetDomElementMock = jest
Expand All @@ -122,30 +121,7 @@ describe('SeekBarLabel', () => {
}),
});

caretGetDomElementMock = jest.fn().mockReturnValue(MockHelper.generateDOMMock());

seekbarLabel["container"].getDomElement = containerGetDomElementMock;
seekbarLabel["caret"].getDomElement = caretGetDomElementMock;
});

it("when thumbnail within UI container bounds", () => {
const labelRect = {
x: 400,
y: 700,
width: 200,
height: 120,
top: 700,
right: 600,
bottom: 820,
left: 400,
} as DOMRect;

containerGetDomElementMock().get(0).parentElement!.getBoundingClientRect =
jest.fn().mockReturnValue(labelRect);

seekbarLabel.setPositionInBounds(100, uiContainerBoundingRect);

expect(caretGetDomElementMock().css).toHaveBeenCalledWith('transform', null);
});

it("when thumbnail would overflow UI container leftside", () => {
Expand Down
14 changes: 0 additions & 14 deletions src/scss/components/labels/_seekbarlabel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,6 @@
padding-right: 1em;
}

// bottom arrow from http://www.cssarrowplease.com/
.#{$prefix}-seekbar-label-caret {
border: solid transparent;
border-color: transparent;
border-top-color: $color-primary;
border-width: .5em;
height: 0;
margin-left: -.5em;
pointer-events: none;
position: absolute;
top: 100%;
width: 0;
}

.#{$prefix}-seekbar-label-inner {
border: solid $color-primary .0625em;
border-radius: .5em;
Expand Down
9 changes: 1 addition & 8 deletions src/ts/components/seekbar/SeekBarLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class SeekBarLabel extends Container<SeekBarLabelConfig> {
private player: PlayerAPI;
private uiManager: UIInstanceManager;
private readonly container: Container<ContainerConfig>;
private readonly caret: Label<LabelConfig>;

constructor(config: SeekBarLabelConfig = {}) {
super(config);
Expand All @@ -58,11 +57,9 @@ export class SeekBarLabel extends Container<SeekBarLabelConfig> {
cssClass: 'seekbar-label-inner',
});

this.caret = new Label({ cssClasses: ['seekbar-label-caret'] });

this.config = this.mergeConfig(config, {
cssClass: 'ui-seekbar-label',
components: [this.container, this.caret],
components: [this.container],
hidden: true,
}, this.config);
}
Expand Down Expand Up @@ -151,10 +148,6 @@ export class SeekBarLabel extends Container<SeekBarLabelConfig> {

if (preventOverflowOffset !== 0) {
this.getDomElement().css('left', seekPositionPx - preventOverflowOffset + 'px');

this.caret.getDomElement().css('transform', `translateX(${preventOverflowOffset}px)`);
} else {
this.caret.getDomElement().css('transform', null);
}
}

Expand Down

0 comments on commit c68eb5c

Please sign in to comment.