mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
add attrMix.js
This commit is contained in:
1 parent
1438ce5e82
commit
938e8718bc
12 files changed
+268
-232
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { def } from '../utils';
|
||||
|
||||
export default function exclusiveMix(art) {
|
||||
const sizeProps = ['mini', 'pip', 'fullscreen', 'fullscreenWeb'];
|
||||
|
||||
function exclusive(props) {
|
||||
props.forEach((name) => {
|
||||
art.on(name, () => {
|
||||
if (art[name]) {
|
||||
props
|
||||
.filter((item) => item !== name)
|
||||
.forEach((item) => {
|
||||
if (art[item]) {
|
||||
art[item] = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exclusive(sizeProps);
|
||||
|
||||
def(art, 'normalSize', {
|
||||
get() {
|
||||
return sizeProps.every((name) => !art[name]);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user