This commit is contained in:
Harvey Zack committed 2018-10-22 11:32:32 +08:00
1 parent a26afec5ac
commit 59581f9e97
6 files changed
+5 -80

No files matched your search

+2 -29
View File
@@ -2,7 +2,6 @@ export default class Thumbnails {
constructor(art, option) {
this.art = art;
this.option = option;
this.isLoad = false;
this.init();
}
@@ -13,10 +12,8 @@ export default class Thumbnails {
} = this.art;
proxy($progress, 'mousemove', event => {
this.checkLoad(this.art.option.thumbnails.url).then(() => {
this.option.ref.style.display = 'block';
this.showThumbnails(event);
});
this.option.ref.style.display = 'block';
this.showThumbnails(event);
});
proxy($progress, 'mouseout', () => {
@@ -24,30 +21,6 @@ export default class Thumbnails {
});
}
checkLoad(url) {
if (this.isLoad) {
return Promise.resolve(url);
}
const { proxy } = this.art.events;
return new Promise((resolve, reject) => {
const $img = new Image();
$img.src = url;
if ($img.complete) {
this.isLoad = true;
resolve(url);
}
proxy($img, 'load', () => {
this.isLoad = true;
resolve(url);
});
proxy($img, 'error', () => {
reject(url);
});
});
}
showThumbnails(event) {
const { $progress } = this.art.refs;
const { width: posWidth } = this.getPosFromEvent(event);
-5
View File
@@ -1,5 +0,0 @@
import Mse from './mse';
export default {
Mse
};
-6
View File
@@ -1,6 +0,0 @@
export default class Mse {
constructor(art) {
this.art = art;
console.log(this);
}
}
-6
View File
@@ -1,6 +0,0 @@
export default class Srt {
constructor(art) {
this.art = art;
console.log(this);
}
}