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,6 +1908,8 @@ 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;
|
||||
|
|
@ -1916,8 +1918,9 @@ document.addEventListener('touchstart', e => {
|
|||
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 = '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ var chatScreen = `
|
|||
</div>
|
||||
<div style="padding: 1rem; border-top: var(--border-width) solid var(--light-border-color); display: flex; gap: 0.5rem;">
|
||||
<textarea id="chat-input" class="forminput" style="flex-grow: 1; margin: 0; resize: none; min-height: 2.5rem; max-height: 8rem; padding: 0.5rem;" placeholder="{blah(placeholder.message.input)}" onkeydown="handleChatInputKey(event)" oninput="handleChatInputResize(this)"></textarea>
|
||||
<button class="submit-button" onclick="sendMessage()" style="margin: 0; padding: 0; aspect-ratio: 1;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.9 -0.5 15.6 16" fill="none" width="1.5rem">
|
||||
<path stroke="var(--main-bg-color)" stroke-linecap="round" stroke-linejoin="round" d="m3.75 7.5 -1.875 5.625 11.25 -5.625L1.875 1.875l1.875 5.625zm0 0h3.75" stroke-width="1.1"></path>
|
||||
<button class="submit-button" onclick="sendMessage(this)" style="margin: 0; padding: 0; width: 2.5rem; min-height: 2.5rem; max-height: 8rem;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1.5rem" height="1.5rem" viewBox="0 0 16 16" fill="none">
|
||||
<path stroke="var(--main-bg-color)" stroke-linecap="round" stroke-linejoin="round" d="M 4.65 8 l -1.875 5.625 l 11.25 -5.625 L 2.775 2.375 l 1.875 5.625 z m 0 0 h 3.75" stroke-width="1.1"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -171,6 +171,16 @@ indicator.active {
|
|||
border-radius: 0.65rem;
|
||||
}
|
||||
|
||||
button {
|
||||
overflow: hidden;
|
||||
}
|
||||
button svg {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
button img {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
.reaction-pill {
|
||||
backface-visibility: hidden;
|
||||
transform: translateZ(0);
|
||||
|
|
|
|||
|
|
@ -1908,6 +1908,8 @@ 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;
|
||||
|
|
@ -1916,8 +1918,9 @@ document.addEventListener('touchstart', e => {
|
|||
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 = '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ var chatScreen = `
|
|||
</div>
|
||||
<div style="padding: 1rem; border-top: var(--border-width) solid var(--light-border-color); display: flex; gap: 0.5rem;">
|
||||
<textarea id="chat-input" class="forminput" style="flex-grow: 1; margin: 0; resize: none; min-height: 2.5rem; max-height: 8rem; padding: 0.5rem;" placeholder="{blah(placeholder.message.input)}" onkeydown="handleChatInputKey(event)" oninput="handleChatInputResize(this)"></textarea>
|
||||
<button class="submit-button" onclick="sendMessage()" style="margin: 0; padding: 0; aspect-ratio: 1;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.9 -0.5 15.6 16" fill="none" width="1.5rem">
|
||||
<path stroke="var(--main-bg-color)" stroke-linecap="round" stroke-linejoin="round" d="m3.75 7.5 -1.875 5.625 11.25 -5.625L1.875 1.875l1.875 5.625zm0 0h3.75" stroke-width="1.1"></path>
|
||||
<button class="submit-button" onclick="sendMessage(this)" style="margin: 0; padding: 0; width: 2.5rem; min-height: 2.5rem; max-height: 8rem;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1.5rem" height="1.5rem" viewBox="0 0 16 16" fill="none">
|
||||
<path stroke="var(--main-bg-color)" stroke-linecap="round" stroke-linejoin="round" d="M 4.65 8 l -1.875 5.625 l 11.25 -5.625 L 2.775 2.375 l 1.875 5.625 z m 0 0 h 3.75" stroke-width="1.1"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -171,6 +171,16 @@ indicator.active {
|
|||
border-radius: 0.65rem;
|
||||
}
|
||||
|
||||
button {
|
||||
overflow: hidden;
|
||||
}
|
||||
button svg {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
button img {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
.reaction-pill {
|
||||
backface-visibility: hidden;
|
||||
transform: translateZ(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue