-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the subtitle settings panel for the new layout #655
Enable the subtitle settings panel for the new layout #655
Conversation
…ern-subtitle-settings-panel # Conflicts: # src/scss/demo.scss # src/scss/skin-super-modern/components/_settingspanelpage.scss
…functionality in the default ones
buttonElement.on('click', (e) => { | ||
e.stopPropagation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to prevent the event from bubbling up to the parent element.
Example: In the new design, the whole SettingsPanelItem
is clickable. The subtitle customization item also contains a button to a different page. Without this change, both would trigger when clicking the button.
protected mergeConfig<Config>(config: Config, defaults: Config, base: Config): Config { | ||
protected mergeConfig<Config>(config: Config, defaults: Partial<Config>, base: Config): Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not every component can fill all of its default config values. It does not need to fill out all as others are required anyway on initialization. To improve the type handling I decided to make this Partial
here. The alternative (which was used before) was a cast to the Config type.
src/ts/components/seekbar.ts
Outdated
// TODO: the problem is that the SeekbarLabel is also inside the seekbarContainer and therefore reacts to the | ||
// TODO: mouse inputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be handled in a follow up PR.
this.getDomElement().on('mouseenter', () => { | ||
// On mouse enter clear the timeout | ||
this.hideTimeout.clear(); | ||
this.getDomElement().on('mouseenter mousemove', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add the mousemove
event here as well because the focusout
event triggers between SettingsPanelPage
transitions causing the settings panel to hide after selecting anything.
if (config.pageTransitionAnimation) { | ||
const handleResize = () => { | ||
// Reset the dimension of the settingsPanel to let the browser calculate the new dimension after resizing | ||
this.getDomElement().css({ width: '', height: '' }); | ||
}; | ||
|
||
player.on(player.exports.PlayerEvent.PlayerResized, handleResize); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a workaround within the animation handling where the width and height of the SettingsPanel
are set to the current dimension. This breaks the SettingsPanel
when resizing the browser window. Removing the width and height properties on resize fixes this.
addPage(page: SettingsPanelPage) { | ||
this.addComponent(page); | ||
this.updateComponents(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience method to add a SettingsPanelPage
element.
targetPage.onActiveEvent(); | ||
sourcePage.onInactiveEvent(); | ||
targetPage.onActiveEvent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous order was 'wrong' and caused an issue with the new dynamic SettingsPanelPage
approach, where the previous page would get the inactive event after the new page got the active event.
}; | ||
|
||
constructor(label: LocalizableText | Component<ComponentConfig>, setting: Component<ComponentConfig>, config: ContainerConfig = {}, addSettingAsComponent: boolean = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored the constructor to follow our config-based approach, which we follow for almost all other Components.
}; | ||
|
||
constructor(label: LocalizableText | Component<ComponentConfig>, setting: Component<ComponentConfig>, config: ContainerConfig = {}, addSettingAsComponent: boolean = true) { | ||
constructor(config: SettingsPanelItemConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This second constructor overload is a workaround for the weak-type-detection issue when there is no property of the parent type used.
Not adding this requires to cast the config to a SettingsPanelItemConfig
on every usage which is cumbersome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was refactored to the DynamicSettingsPanelItem
@@ -6,92 +6,6 @@ | |||
&.#{$prefix}-active { | |||
display: block; | |||
} | |||
|
|||
// A "line" in the panel: a container holding a label + control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The styling for a settings-panel-item was extracted into a separate file.
settingsPanel: SettingsPanel; | ||
overlay: SubtitleOverlay; | ||
useDynamicSettingsPanelItem?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still don't know how we want to ship the new UI layout. We are currently leaning towards a new major version. Once this decision is confirmed I'll rework this and just change to the new dynamic approach and throw out the config option again. For now I didn't want to create a subclass for this as the code is very similar.
…tle-settings-panel
….com:bitmovin/bitmovin-player-ui into feature/super-modern-subtitle-settings-panel
Description
The current version of the new UI layout does not support subtitle customization settings.
Changes
In order to add support for the subtitle customization settings I had to refactor quite a bit inside the
SettingsPanel
. The changes are outlined in detail below.ModernSettingsPanelItem
was refactored and split into aDynamicSettingsPanelItem
and aSettingsPanelSelectOption
instead of handling both in the same component.ModernSettingsPanelPage
andModernSettingsPanel
were removed and their functionality was moved into the parent components.SubtitleSettingsPanelPage
now supports the old and the new layout.Checklist (for PR submitter and reviewers)
CHANGELOG
entry A generic redesign changelog with all changes will be added at the end