mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
优化gif演示
This commit is contained in:
1 parent
56eba5626e
commit
02c63e55e8
4 files changed
+25
-45
No files matched your search
@@ -53,6 +53,7 @@ function artplayerPluginGif(art) {
|
||||
let isProcessing = false;
|
||||
let pressStartTime = 0;
|
||||
let progressTimer = null;
|
||||
let isPress = false;
|
||||
|
||||
function cleanTimer() {
|
||||
$progress.style.width = '0%';
|
||||
@@ -63,7 +64,6 @@ function artplayerPluginGif(art) {
|
||||
function createGif() {
|
||||
cleanTimer();
|
||||
const pressTime = new Date() - pressStartTime;
|
||||
|
||||
if (isProcessing) {
|
||||
notice.show(i18n.get('There is another gif in the processing'));
|
||||
} else if (pressTime < 1000) {
|
||||
@@ -90,6 +90,7 @@ function artplayerPluginGif(art) {
|
||||
html: 'GIF',
|
||||
mounted: $gif => {
|
||||
proxy($gif, 'mousedown', () => {
|
||||
isPress = true;
|
||||
cleanTimer();
|
||||
pressStartTime = new Date();
|
||||
notice.show(i18n.get('Long press, gif length is between 1 second and 5 seconds'));
|
||||
@@ -106,8 +107,11 @@ function artplayerPluginGif(art) {
|
||||
})();
|
||||
});
|
||||
|
||||
proxy($gif, 'mouseup', () => {
|
||||
createGif();
|
||||
proxy(document, 'mouseup', () => {
|
||||
if (isPress) {
|
||||
isPress = false;
|
||||
createGif();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user