mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00: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
+10
-34
@@ -1,4 +1,6 @@
|
|||||||
html, body, .container {
|
html,
|
||||||
|
body,
|
||||||
|
.container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,43 +11,17 @@ html, body, .container {
|
|||||||
|
|
||||||
.part-top {
|
.part-top {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
height: 70%;
|
height: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.part-top .artplayer {
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
.part-bottom {
|
.part-bottom {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 30%;
|
height: 30%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.part-left {
|
|
||||||
width: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.part-right {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.part-left .artplayer {
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.part-right .preview {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: #f3f3f3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.part-right .preview img {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
+1
-6
@@ -18,12 +18,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="part-top">
|
<div class="part-top">
|
||||||
<div class="part-left">
|
<div class="artplayer"></div>
|
||||||
<div class="artplayer"></div>
|
|
||||||
</div>
|
|
||||||
<div class="part-right">
|
|
||||||
<div class="preview"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="part-bottom"></div>
|
<div class="part-bottom"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2772,6 +2772,7 @@
|
|||||||
var isProcessing = false;
|
var isProcessing = false;
|
||||||
var pressStartTime = 0;
|
var pressStartTime = 0;
|
||||||
var progressTimer = null;
|
var progressTimer = null;
|
||||||
|
var isPress = false;
|
||||||
|
|
||||||
function cleanTimer() {
|
function cleanTimer() {
|
||||||
$progress.style.width = '0%';
|
$progress.style.width = '0%';
|
||||||
@@ -2807,6 +2808,7 @@
|
|||||||
html: 'GIF',
|
html: 'GIF',
|
||||||
mounted: function mounted($gif) {
|
mounted: function mounted($gif) {
|
||||||
proxy($gif, 'mousedown', function () {
|
proxy($gif, 'mousedown', function () {
|
||||||
|
isPress = true;
|
||||||
cleanTimer();
|
cleanTimer();
|
||||||
pressStartTime = new Date();
|
pressStartTime = new Date();
|
||||||
notice.show(i18n.get('Long press, gif length is between 1 second and 5 seconds'));
|
notice.show(i18n.get('Long press, gif length is between 1 second and 5 seconds'));
|
||||||
@@ -2824,8 +2826,11 @@
|
|||||||
}, 50);
|
}, 50);
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
proxy($gif, 'mouseup', function () {
|
proxy(document, 'mouseup', function () {
|
||||||
createGif();
|
if (isPress) {
|
||||||
|
isPress = false;
|
||||||
|
createGif();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ function artplayerPluginGif(art) {
|
|||||||
let isProcessing = false;
|
let isProcessing = false;
|
||||||
let pressStartTime = 0;
|
let pressStartTime = 0;
|
||||||
let progressTimer = null;
|
let progressTimer = null;
|
||||||
|
let isPress = false;
|
||||||
|
|
||||||
function cleanTimer() {
|
function cleanTimer() {
|
||||||
$progress.style.width = '0%';
|
$progress.style.width = '0%';
|
||||||
@@ -63,7 +64,6 @@ function artplayerPluginGif(art) {
|
|||||||
function createGif() {
|
function createGif() {
|
||||||
cleanTimer();
|
cleanTimer();
|
||||||
const pressTime = new Date() - pressStartTime;
|
const pressTime = new Date() - pressStartTime;
|
||||||
|
|
||||||
if (isProcessing) {
|
if (isProcessing) {
|
||||||
notice.show(i18n.get('There is another gif in the processing'));
|
notice.show(i18n.get('There is another gif in the processing'));
|
||||||
} else if (pressTime < 1000) {
|
} else if (pressTime < 1000) {
|
||||||
@@ -90,6 +90,7 @@ function artplayerPluginGif(art) {
|
|||||||
html: 'GIF',
|
html: 'GIF',
|
||||||
mounted: $gif => {
|
mounted: $gif => {
|
||||||
proxy($gif, 'mousedown', () => {
|
proxy($gif, 'mousedown', () => {
|
||||||
|
isPress = true;
|
||||||
cleanTimer();
|
cleanTimer();
|
||||||
pressStartTime = new Date();
|
pressStartTime = new Date();
|
||||||
notice.show(i18n.get('Long press, gif length is between 1 second and 5 seconds'));
|
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', () => {
|
proxy(document, 'mouseup', () => {
|
||||||
createGif();
|
if (isPress) {
|
||||||
|
isPress = false;
|
||||||
|
createGif();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user