add Artplayer.LOG_VERSION

This commit is contained in:
Harvey Zack committed 2023-08-22 20:51:39 +08:00
1 parent 3179d1241e
commit 894a9db1d7
34 files changed
+182 -136

No files matched your search

+13 -13
View File
@@ -60,7 +60,7 @@ export default class Setting extends Component {
const item = option[index];
item.$parentItem = parentItem;
item.$parentList = parentList;
Setting.makeRecursion(item.selector || [], item, option);
Setting.makeRecursion(item.selector ?? [], item, option);
}
return option;
}
@@ -111,7 +111,7 @@ export default class Setting extends Component {
if (item.name === name) {
return item;
} else {
const result = this.find(name, item.selector || []);
const result = this.find(name, item.selector ?? []);
if (result) return result;
}
}
@@ -120,7 +120,7 @@ export default class Setting extends Component {
remove(name) {
const item = this.find(name);
errorHandle(item, `Can't find [${name}] from the [setting]`);
const parent = item.$parentItem?.selector || this.option;
const parent = item.$parentItem?.selector ?? this.option;
parent.splice(parent.indexOf(item), 1);
this.option = Setting.makeRecursion(this.option);
this.destroy();
@@ -190,13 +190,13 @@ export default class Setting extends Component {
switch (type) {
case 'switch':
case 'range':
append($icon, isStringOrNumber(item.icon) || item.icon instanceof Element ? item.icon : icons.config);
append($icon, isStringOrNumber(item.icon) ?? item.icon instanceof Element ? item.icon : icons.config);
break;
case 'selector':
if (item.selector && item.selector.length) {
append(
$icon,
isStringOrNumber(item.icon) || item.icon instanceof Element ? item.icon : icons.config,
isStringOrNumber(item.icon) ?? item.icon instanceof Element ? item.icon : icons.config,
);
} else {
append($icon, icons.check);
@@ -223,7 +223,7 @@ export default class Setting extends Component {
const $html = createElement('div');
addClass($html, 'art-setting-item-left-text');
append($html, item.html || '');
append($html, item.html ?? '');
append($left, $html);
item.$html = $html;
@@ -241,7 +241,7 @@ export default class Setting extends Component {
const $tooltip = createElement('div');
addClass($tooltip, 'art-setting-item-right-tooltip');
append($tooltip, item.tooltip || '');
append($tooltip, item.tooltip ?? '');
append($right, $tooltip);
item.$tooltip = $tooltip;
@@ -290,10 +290,10 @@ export default class Setting extends Component {
const $state = createElement('div');
addClass($state, 'art-setting-item-right-icon');
const $range = append($state, '<input type="range">');
$range.value = item.range[0] || 0;
$range.min = item.range[1] || 0;
$range.max = item.range[2] || 10;
$range.step = item.range[3] || 1;
$range.value = item.range[0] ?? 0;
$range.min = item.range[1] ?? 0;
$range.max = item.range[2] ?? 10;
$range.step = item.range[3] ?? 1;
addClass($range, 'art-setting-range');
append($right, $state);
item.$range = $range;
@@ -398,7 +398,7 @@ export default class Setting extends Component {
} = this.art;
if (controls.setting && !isMobile) {
const settingWidth = width || constructor.SETTING_WIDTH;
const settingWidth = width ?? constructor.SETTING_WIDTH;
const { left: controlLeft, width: controlWidth } = controls.setting.getBoundingClientRect();
const { left: playerLeft, width: playerWidth } = $player.getBoundingClientRect();
const settingLeft = controlLeft - playerLeft + controlWidth / 2 - settingWidth / 2;
@@ -424,7 +424,7 @@ export default class Setting extends Component {
} else {
const $panel = createElement('div');
addClass($panel, 'art-setting-panel');
$panel.dataset.width = width || constructor.SETTING_WIDTH;
$panel.dataset.width = width ?? constructor.SETTING_WIDTH;
$panel.dataset.height = option.length * constructor.SETTING_ITEM_HEIGHT;
if (option[0] && option[0].$parentItem) {