mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed incorrect seeking of voice messages with transcribe button.
This commit is contained in:
parent
a1369aaad0
commit
fa773c3024
1 changed files with 15 additions and 11 deletions
|
@ -1262,18 +1262,22 @@ TextState Document::textState(
|
||||||
void Document::updatePressed(QPoint point) {
|
void Document::updatePressed(QPoint point) {
|
||||||
// LayoutMode should be passed here.
|
// LayoutMode should be passed here.
|
||||||
if (const auto voice = Get<HistoryDocumentVoice>()) {
|
if (const auto voice = Get<HistoryDocumentVoice>()) {
|
||||||
if (voice->seeking()) {
|
if (!voice->seeking()) {
|
||||||
const auto thumbed = Get<HistoryDocumentThumbed>();
|
return;
|
||||||
const auto &st = thumbed ? st::msgFileThumbLayout : st::msgFileLayout;
|
|
||||||
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
|
||||||
const auto nameright = st.padding.right();
|
|
||||||
voice->setSeekingCurrent(std::clamp(
|
|
||||||
(point.x() - nameleft)
|
|
||||||
/ float64(width() - nameleft - nameright),
|
|
||||||
0.,
|
|
||||||
1.));
|
|
||||||
repaint();
|
|
||||||
}
|
}
|
||||||
|
const auto thumbed = Get<HistoryDocumentThumbed>();
|
||||||
|
const auto &st = thumbed ? st::msgFileThumbLayout : st::msgFileLayout;
|
||||||
|
const auto nameleft = st.padding.left() + st.thumbSize + st.thumbSkip;
|
||||||
|
const auto nameright = st.padding.right();
|
||||||
|
const auto transcribeWidth = voice->transcribe
|
||||||
|
? (st::historyTranscribeSkip + voice->transcribe->size().width())
|
||||||
|
: 0;
|
||||||
|
voice->setSeekingCurrent(std::clamp(
|
||||||
|
(point.x() - nameleft)
|
||||||
|
/ float64(width() - transcribeWidth - nameleft - nameright),
|
||||||
|
0.,
|
||||||
|
1.));
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue