mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-13 05:48:34 +02:00
Remove debug prints, lower scroll sensitivity and make it a preproc constant
This commit is contained in:
parent
34d073bb61
commit
5fb9ec8a94
3 changed files with 4 additions and 7 deletions
|
@ -441,9 +441,6 @@ void WebEntityRenderer::handlePointerEvent(const PointerEvent& event) {
|
|||
}
|
||||
|
||||
void WebEntityRenderer::handlePointerEventAsTouch(const PointerEvent& event) {
|
||||
if (event.getType() == PointerEvent::Scroll) {
|
||||
qInfo() << "RenderableWebEntityItem::handlePointerEventAsTouch: PointerEvent::Scroll" << QPointF(event.getScroll().x, event.getScroll().y);
|
||||
}
|
||||
PointerEvent webEvent = event;
|
||||
webEvent.setPos2D(event.getPos2D() * (METERS_TO_INCHES * _dpi));
|
||||
_webSurface->handlePointerEvent(webEvent, _touchDevice);
|
||||
|
@ -482,10 +479,9 @@ void WebEntityRenderer::handlePointerEventAsMouse(const PointerEvent& event) {
|
|||
}
|
||||
|
||||
if (type == QEvent::Wheel) {
|
||||
const auto& scroll = event.getScroll() * -24.0f;
|
||||
const auto& scroll = event.getScroll() * POINTEREVENT_SCROLL_SENSITIVITY;
|
||||
QWheelEvent wheelEvent(windowPoint, windowPoint, QPoint(), QPoint(scroll.x, scroll.y), buttons, event.getKeyboardModifiers(), Qt::ScrollPhase::NoScrollPhase, false);
|
||||
QCoreApplication::sendEvent(_webSurface->getWindow(), &wheelEvent);
|
||||
qInfo() << "RenderableWebEntityItem::handlePointerEventAsMouse: QEvent::Wheel" << QPoint(scroll.x, scroll.y) << buttons;
|
||||
} else {
|
||||
QMouseEvent mouseEvent(type, windowPoint, windowPoint, windowPoint, button, buttons, event.getKeyboardModifiers());
|
||||
QCoreApplication::sendEvent(_webSurface->getWindow(), &mouseEvent);
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
class ScriptEngine;
|
||||
|
||||
#define POINTEREVENT_SCROLL_SENSITIVITY -16.0f
|
||||
|
||||
/// Represents a 2D or 3D pointer to the scripting engine. Exposed as <code><a href="https://apidocs.overte.org/global.html#PointerEvent">PointerEvent</a></code>
|
||||
class PointerEvent {
|
||||
public:
|
||||
|
|
|
@ -584,12 +584,11 @@ bool OffscreenQmlSurface::handlePointerEvent(const PointerEvent& event, class QT
|
|||
}
|
||||
|
||||
if (event.getType() == PointerEvent::Scroll) {
|
||||
auto scroll = event.getScroll() * -24.0f;
|
||||
auto scroll = event.getScroll() * POINTEREVENT_SCROLL_SENSITIVITY;
|
||||
QWheelEvent wheelEvent(windowPoint, windowPoint, QPoint(), QPoint(scroll.x, scroll.y), buttons, event.getKeyboardModifiers(), Qt::ScrollPhase::NoScrollPhase, false);
|
||||
if (QCoreApplication::sendEvent(getWindow(), &wheelEvent)) {
|
||||
eventSent = true;
|
||||
eventsAccepted &= wheelEvent.isAccepted();
|
||||
qInfo() << "OffscreenQmlSurface::handlePointerEvent: PointerEvent::Scroll" << QPointF(scroll.x, scroll.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue