mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 11:21:20 -08:00
30 lines
650 B
JavaScript
30 lines
650 B
JavaScript
import { def } from '../utils';
|
|
|
|
export default function rectMix(art, player) {
|
|
def(player, 'rect', {
|
|
get: () => {
|
|
return art.template.$player.getBoundingClientRect();
|
|
},
|
|
});
|
|
|
|
['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(key => {
|
|
def(player, key, {
|
|
get: () => {
|
|
return player.rect[key];
|
|
},
|
|
});
|
|
});
|
|
|
|
def(player, 'x', {
|
|
get: () => {
|
|
return player.left + window.pageXOffset;
|
|
},
|
|
});
|
|
|
|
def(player, 'y', {
|
|
get: () => {
|
|
return player.top + window.pageYOffset;
|
|
},
|
|
});
|
|
}
|