mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
disabled drop preview animation
This commit is contained in:
parent
463a1f1945
commit
5fcf42f1fc
|
@ -118,7 +118,8 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
|
|||
|
||||
this->splits.messageSeperator = isLight ? QColor(127, 127, 127) : QColor(60, 60, 60);
|
||||
this->splits.background = getColor(0, sat, 1);
|
||||
this->splits.dropPreview = getColor(hue, 0.5, 0.5, 0.6);
|
||||
this->splits.dropPreview = QColor(0, 148, 255, 0x30);
|
||||
this->splits.dropPreviewBorder = QColor(0, 148, 255, 0x70);
|
||||
// this->splits.border
|
||||
// this->splits.borderFocused
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
QColor border;
|
||||
QColor borderFocused;
|
||||
QColor dropPreview;
|
||||
QColor dropPreviewBorder;
|
||||
|
||||
struct {
|
||||
QColor border;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "widgets/helper/droppreview.hpp"
|
||||
#include "application.hpp"
|
||||
#include "singletons/thememanager.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -9,9 +10,9 @@ namespace widgets {
|
|||
|
||||
NotebookPageDropPreview::NotebookPageDropPreview(BaseWidget *parent)
|
||||
: BaseWidget(parent)
|
||||
, positionAnimation(this, "geometry")
|
||||
// , positionAnimation(this, "geometry")
|
||||
{
|
||||
this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
||||
// this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
||||
this->setHidden(true);
|
||||
}
|
||||
|
||||
|
@ -19,34 +20,35 @@ void NotebookPageDropPreview::paintEvent(QPaintEvent *)
|
|||
{
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(8, 8, this->width() - 17, this->height() - 17,
|
||||
this->themeManager->splits.dropPreview);
|
||||
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||
painter.drawRect(8, 8, this->width() - 17, this->height() - 17);
|
||||
}
|
||||
|
||||
void NotebookPageDropPreview::hideEvent(QHideEvent *)
|
||||
{
|
||||
this->animate = false;
|
||||
// this->animate = false;
|
||||
}
|
||||
|
||||
void NotebookPageDropPreview::setBounds(const QRect &rect)
|
||||
{
|
||||
if (rect == this->desiredGeometry) {
|
||||
return;
|
||||
}
|
||||
// if (rect == this->desiredGeometry) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this->animate) {
|
||||
this->positionAnimation.stop();
|
||||
this->positionAnimation.setDuration(50);
|
||||
this->positionAnimation.setStartValue(this->geometry());
|
||||
this->positionAnimation.setEndValue(rect);
|
||||
this->positionAnimation.start();
|
||||
} else {
|
||||
this->setGeometry(rect);
|
||||
}
|
||||
// if (this->animate) {
|
||||
// this->positionAnimation.stop();
|
||||
// this->positionAnimation.setDuration(50);
|
||||
// this->positionAnimation.setStartValue(this->geometry());
|
||||
// this->positionAnimation.setEndValue(rect);
|
||||
// this->positionAnimation.start();
|
||||
// } else {
|
||||
this->setGeometry(rect);
|
||||
// }
|
||||
|
||||
this->desiredGeometry = rect;
|
||||
// this->desiredGeometry = rect;
|
||||
|
||||
this->animate = true;
|
||||
// this->animate = true;
|
||||
}
|
||||
|
||||
} // namespace widgets
|
||||
|
|
|
@ -19,9 +19,9 @@ protected:
|
|||
void paintEvent(QPaintEvent *) override;
|
||||
void hideEvent(QHideEvent *) override;
|
||||
|
||||
QPropertyAnimation positionAnimation;
|
||||
QRect desiredGeometry;
|
||||
bool animate = false;
|
||||
// QPropertyAnimation positionAnimation;
|
||||
// QRect desiredGeometry;
|
||||
// bool animate = false;
|
||||
};
|
||||
|
||||
} // namespace widgets
|
||||
|
|
|
@ -62,10 +62,14 @@ SplitOverlay::SplitOverlay(Split *parent)
|
|||
up->setFocusPolicy(Qt::NoFocus);
|
||||
down->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
move->setCursor(Qt::SizeAllCursor);
|
||||
move->setCursor(Qt::PointingHandCursor);
|
||||
left->setCursor(Qt::PointingHandCursor);
|
||||
right->setCursor(Qt::PointingHandCursor);
|
||||
up->setCursor(Qt::PointingHandCursor);
|
||||
down->setCursor(Qt::PointingHandCursor);
|
||||
|
||||
this->managedConnect(this->scaleChanged, [=](float scale) {
|
||||
int a = scale * 40;
|
||||
this->managedConnect(this->scaleChanged, [=](float _scale) {
|
||||
int a = _scale * 40;
|
||||
QSize size(a, a);
|
||||
|
||||
move->setIconSize(size);
|
||||
|
@ -97,8 +101,8 @@ void SplitOverlay::paintEvent(QPaintEvent *event)
|
|||
} break;
|
||||
}
|
||||
if (!rect.isNull()) {
|
||||
painter.setPen(QColor(0, 148, 255, 0x70));
|
||||
painter.setBrush(QColor(0, 148, 255, 0x30));
|
||||
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
|
||||
painter.setBrush(getApp()->themes->splits.dropPreview);
|
||||
painter.drawRect(rect);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -403,6 +403,7 @@ void SplitContainer::setPreviewRect(QPoint mousePos)
|
|||
this->dropPreview.setBounds(region.rect);
|
||||
|
||||
if (!this->dropPreview.isVisible()) {
|
||||
this->dropPreview.setGeometry(this->rect());
|
||||
this->dropPreview.show();
|
||||
this->dropPreview.raise();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue