Use applet geometry for panel scroll margins

This commit is contained in:
ajp_anton
2026-09-09 22:12:24 +00:00
parent f5988605c8
commit 787231cb03
8 changed files with 177 additions and 22 deletions
+3 -3
View File
@@ -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;
+1 -1
View File
@@ -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;