Jebane kurwa gesty blokuja mi przycisk
This commit is contained in:
parent
3f99389413
commit
80f11f782e
6 changed files with 66 additions and 16 deletions
|
|
@ -1908,16 +1908,19 @@ let touchStartY = 0;
|
|||
let touchEndY = 0;
|
||||
let touchMoved = false;
|
||||
|
||||
let pressDate;
|
||||
|
||||
document.addEventListener('touchstart', e => {
|
||||
touchStartX = e.changedTouches[0].screenX;
|
||||
touchStartY = e.changedTouches[0].screenY;
|
||||
touchMoved = false;
|
||||
|
||||
|
||||
activeTouchButton = e.target.closest('button, input, textarea');
|
||||
if (activeTouchButton) {
|
||||
activeTouchButton.classList.add('is-pressed');
|
||||
pressDate = Date.now();
|
||||
}
|
||||
}, {passive: true});
|
||||
}, {passive: false});
|
||||
|
||||
document.addEventListener('touchmove', e => {
|
||||
if (!touchMoved) {
|
||||
|
|
@ -1937,9 +1940,9 @@ document.addEventListener('touchmove', e => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}, {passive: true});
|
||||
}, {passive: false});
|
||||
|
||||
document.addEventListener('touchend', e => {
|
||||
document.addEventListener('touchend', async (e) => {
|
||||
touchEndX = e.changedTouches[0].screenX;
|
||||
touchEndY = e.changedTouches[0].screenY;
|
||||
|
||||
|
|
@ -1948,6 +1951,13 @@ document.addEventListener('touchend', e => {
|
|||
handleMobileSwipe();
|
||||
|
||||
if (activeTouchButton) {
|
||||
|
||||
let elapsed = Date.now() - pressDate; //nie pomoglo ale zostawie
|
||||
if (elapsed < 100) {
|
||||
const remaining = 100 - elapsed;
|
||||
await delay(remaining);
|
||||
}
|
||||
|
||||
activeTouchButton.classList.remove('is-pressed');
|
||||
|
||||
if (!touchMoved) {
|
||||
|
|
@ -2440,7 +2450,7 @@ function setupChatScrollListener() {
|
|||
|
||||
let replyingToMsgId = null;
|
||||
|
||||
async function sendMessage() {
|
||||
async function sendMessage(sendbutton) {
|
||||
if (!currentDmId || !currentDmKey) return;
|
||||
|
||||
let input = document.getElementById("chat-input");
|
||||
|
|
@ -2475,6 +2485,7 @@ async function sendMessage() {
|
|||
|
||||
input.value = "";
|
||||
input.style.height = '2.5rem';
|
||||
sendbutton.style.height = '2.5rem';
|
||||
|
||||
window.forceScrollToBottom = true;
|
||||
replyingToMsgId = null;
|
||||
|
|
@ -2517,11 +2528,15 @@ async function sendMessage() {
|
|||
}
|
||||
|
||||
function handleChatInputResize(textarea) {
|
||||
const sendbutton = textarea.parentElement.children.item(1);
|
||||
|
||||
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
textarea.style.transition = 'none';
|
||||
textarea.style.height = '0rem';
|
||||
sendbutton.style.height = '0rem'; //test
|
||||
let borderHeight = textarea.offsetHeight - textarea.clientHeight;
|
||||
textarea.style.height = ((textarea.scrollHeight + borderHeight) / rem) + 'rem';
|
||||
sendbutton.style.height = ((textarea.scrollHeight + borderHeight) / rem) + 'rem'; //test
|
||||
textarea.offsetHeight; // force reflow
|
||||
textarea.style.transition = '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue