update setting height

This commit is contained in:
Harvey Zack committed 2022-04-29 06:37:23 +08:00
1 parent cc6151d0bd
commit f47138112a
5 files changed
+149 -133

No files matched your search

+1
View File
@@ -200,6 +200,7 @@ export default class Artplayer extends Emitter {
Artplayer.NOTICE_TIME = 2000;
Artplayer.SETTING_WIDTH = 250;
Artplayer.SETTING_ITEM_WIDTH = 200;
Artplayer.SETTING_ITEM_HEIGHT = 35;
Artplayer.INDICATOR_SIZE = 14;
Artplayer.INDICATOR_SIZE_ICON = 16;
Artplayer.INDICATOR_SIZE_MOBILE = 18;
+7 -1
View File
@@ -224,27 +224,33 @@ export default class Setting extends Component {
}
init(option, width) {
const { constructor } = this.art;
if (this.cache.has(option)) {
const $panel = this.cache.get(option);
inverseClass($panel, 'art-current');
setStyle(this.$parent, 'width', `${$panel.dataset.width}px`);
setStyle(this.$parent, 'height', `${$panel.dataset.height}px`);
} else {
const $panel = document.createElement('div');
addClass($panel, 'art-setting-panel');
$panel.dataset.width = width || constructor.SETTING_WIDTH;
$panel.dataset.height = option.length * constructor.SETTING_ITEM_HEIGHT;
if (option[0] && option[0]._parentItem) {
append($panel, this.creatHeader(option[0]));
$panel.dataset.height = Number($panel.dataset.height) + constructor.SETTING_ITEM_HEIGHT;
}
for (let index = 0; index < option.length; index++) {
append($panel, this.creatItem(option[index]));
}
$panel.dataset.width = width || this.art.constructor.SETTING_WIDTH;
append(this.$parent, $panel);
this.cache.set(option, $panel);
inverseClass($panel, 'art-current');
setStyle(this.$parent, 'width', `${$panel.dataset.width}px`);
setStyle(this.$parent, 'height', `${$panel.dataset.height}px`);
if (option[0] && option[0]._parentItem && option[0]._parentItem.mounted) {
option[0]._parentItem.mounted.call(this.art, $panel, option[0]._parentItem);
@@ -5,6 +5,7 @@
z-index: 90;
right: 10px;
bottom: 50px;
height: auto;
overflow: auto;
font-size: 13px;
border-radius: 3px;