diff --git a/src/music.js b/src/music.js index f50fb5e..819c306 100644 --- a/src/music.js +++ b/src/music.js @@ -47,11 +47,28 @@ export default class MusicList { maxWidth: '20rem', maxHeight: '70vh', overflow: 'hidden', boxShadow: '0 0 1rem #eee', display: 'flex', flexDirection: 'column', - fontSize: '12px' + fontSize: '12px', userSelect: 'none', }, onclick: event => { this.ul.classList.toggle('disable') }, + onmousedown({ srcElement: dom, clientX, clientY }) { + if (dom !== element) return + const [w, h] = [innerWidth - dom.offsetWidth, innerWidth - dom.offsetHeight] + document.onmouseup = () => { + if (dom.offsetLeft < 0) dom.style.left = '0px' + if (dom.offsetTop < 0) dom.style.top = '0px' + if (dom.offsetLeft > w) dom.style.left = w + 'px' + if (dom.offsetTop > h) dom.style.top = h + 'px' + document.onmouseup = document.onmousemove = null + localStorage.setItem('playerXY', dom.style.left + ',' + dom.style.top) + } + document.onmousemove = ({ clientX: x, clientY: y }) => { + dom.style.left = dom.offsetLeft - clientX + x + 'px' + dom.style.top = dom.offsetTop - clientY + y + 'px'; + [clientX, clientY] = [x, y] + } + }, children: [ this.audio, this.ul, diff --git a/src/weigets.js b/src/weigets.js index df3f9ec..cddb019 100644 --- a/src/weigets.js +++ b/src/weigets.js @@ -127,7 +127,7 @@ export function UploadMusic(options) { options.onchange(files) }, children: [ - // 绘制一个云朵上传图标(别放弃...还有我呢!) + // 绘制一个云朵上传图标 createElement({ style: { width: '82px', @@ -183,7 +183,7 @@ export function UploadMusic(options) { fontWeight: 'bold', position: 'relative', top: '-2.25rem', - color: '#e7f4fd', + color: '#e7f8fd', textShadow: '0 1px 1px #fff', //textShadow: '0 0 5px #000, 0 0 10px #000, 0 0 15px #000, 0 0 20px #000, 0 0 25px #000, 0 0 30px #000, 0 0 35px #000, 0 0 40px #000, 0 0 45px #000, 0 0 50px #000, 0 0 55px #000, 0 0 60px #000, 0 0 65px #000, 0 0 70px #000, 0 0 75px #000' }