mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Improved distance of reply icon on left swipe.
This commit is contained in:
parent
6129e5a1cf
commit
3d2af9db8e
2 changed files with 5 additions and 5 deletions
|
@ -41,7 +41,7 @@ void SetupSwipeHandler(
|
||||||
const auto state = widget->lifetime().make_state<State>();
|
const auto state = widget->lifetime().make_state<State>();
|
||||||
const auto updateRatio = [=](float64 ratio) {
|
const auto updateRatio = [=](float64 ratio) {
|
||||||
update({
|
update({
|
||||||
.ratio = std::clamp(ratio, 0., 1.),
|
.ratio = std::clamp(ratio, 0., 1.5),
|
||||||
.reachRatio = state->animationReach.value(0.),
|
.reachRatio = state->animationReach.value(0.),
|
||||||
.translation = (-std::clamp(ratio, 0., 1.5) * threshold),
|
.translation = (-std::clamp(ratio, 0., 1.5) * threshold),
|
||||||
.msgBareId = state->finishByTopData.msgBareId,
|
.msgBareId = state->finishByTopData.msgBareId,
|
||||||
|
|
|
@ -1495,6 +1495,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||||
constexpr auto kBouncePart = 0.25;
|
constexpr auto kBouncePart = 0.25;
|
||||||
constexpr auto kStrokeWidth = 2.;
|
constexpr auto kStrokeWidth = 2.;
|
||||||
constexpr auto kWaveWidth = 10.;
|
constexpr auto kWaveWidth = 10.;
|
||||||
|
const auto ratio = std::min(context.gestureHorizontal.ratio, 1.);
|
||||||
const auto reachRatio = context.gestureHorizontal.reachRatio;
|
const auto reachRatio = context.gestureHorizontal.reachRatio;
|
||||||
const auto size = st::historyFastShareSize;
|
const auto size = st::historyFastShareSize;
|
||||||
const auto rect = QRectF(
|
const auto rect = QRectF(
|
||||||
|
@ -1503,8 +1504,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||||
size,
|
size,
|
||||||
size);
|
size);
|
||||||
const auto center = rect::center(rect);
|
const auto center = rect::center(rect);
|
||||||
const auto spanAngle = context.gestureHorizontal.ratio
|
const auto spanAngle = ratio * arc::kFullLength;
|
||||||
* arc::kFullLength;
|
|
||||||
const auto strokeWidth = style::ConvertFloatScale(kStrokeWidth);
|
const auto strokeWidth = style::ConvertFloatScale(kStrokeWidth);
|
||||||
|
|
||||||
const auto reachScale = std::clamp(
|
const auto reachScale = std::clamp(
|
||||||
|
@ -1523,7 +1523,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
auto hq = PainterHighQualityEnabler(p);
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(context.st->msgServiceBg());
|
p.setBrush(context.st->msgServiceBg());
|
||||||
p.setOpacity(context.gestureHorizontal.ratio);
|
p.setOpacity(ratio);
|
||||||
p.translate(center);
|
p.translate(center);
|
||||||
if (reachScale) {
|
if (reachScale) {
|
||||||
p.scale(-(1. + 1. * reachScale), (1. + 1. * reachScale));
|
p.scale(-(1. + 1. * reachScale), (1. + 1. * reachScale));
|
||||||
|
@ -1546,7 +1546,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||||
// p.drawArc(arcRect, arc::kQuarterLength, spanAngle);
|
// p.drawArc(arcRect, arc::kQuarterLength, spanAngle);
|
||||||
if (reachRatio) {
|
if (reachRatio) {
|
||||||
const auto w = style::ConvertFloatScale(kWaveWidth);
|
const auto w = style::ConvertFloatScale(kWaveWidth);
|
||||||
p.setOpacity(context.gestureHorizontal.ratio - reachRatio);
|
p.setOpacity(ratio - reachRatio);
|
||||||
p.drawArc(
|
p.drawArc(
|
||||||
arcRect + Margins(reachRatio * reachRatio * w),
|
arcRect + Margins(reachRatio * reachRatio * w),
|
||||||
arc::kQuarterLength,
|
arc::kQuarterLength,
|
||||||
|
|
Loading…
Add table
Reference in a new issue