Use applet geometry for panel scroll margins
This commit is contained in:
@@ -50,12 +50,12 @@ PanelController::~PanelController()
|
||||
}
|
||||
}
|
||||
|
||||
QString PanelController::areaAt(const QPointF &position)
|
||||
QString PanelController::areaAt(const QPointF &position, bool scrolling)
|
||||
{
|
||||
if (!m_locateArea.isCallable()) {
|
||||
return {};
|
||||
}
|
||||
const QJSValue result = m_locateArea.call({position.x(), position.y()});
|
||||
const QJSValue result = m_locateArea.call({position.x(), position.y(), scrolling});
|
||||
if (result.isError()) {
|
||||
qWarning() << "Panel Actions: could not identify panel area:" << result.toString();
|
||||
return {};
|
||||
@@ -74,7 +74,7 @@ bool PanelController::eventFilter(QObject *object, QEvent *event)
|
||||
}
|
||||
if (event->type() == QEvent::Wheel) {
|
||||
auto *wheel = static_cast<QWheelEvent *>(event);
|
||||
const QString area = areaAt(wheel->position());
|
||||
const QString area = areaAt(wheel->position(), true);
|
||||
const QString action = m_scrollActions.value(area, QStringLiteral("normal")).toString();
|
||||
if (action == QLatin1String("normal") || action.isEmpty()) {
|
||||
m_remainder = 0;
|
||||
|
||||
@@ -27,7 +27,7 @@ Q_SIGNALS:
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
private:
|
||||
QString areaAt(const QPointF &position);
|
||||
QString areaAt(const QPointF &position, bool scrolling = false);
|
||||
QPointer<QQuickWindow> m_panel;
|
||||
bool m_active = false;
|
||||
QJSValue m_locateArea;
|
||||
|
||||
Reference in New Issue
Block a user