adjust to coding standards

This commit is contained in:
beholder 2017-10-27 01:08:01 +03:00
parent 5969e0b118
commit f6fa85fed2
2 changed files with 7 additions and 5 deletions

View file

@ -67,7 +67,7 @@ Item {
var deviceId = Web3DOverlay.deviceIdByTouchPoint(globalPosition.x, globalPosition.y);
var hand = deviceId - 1;
if(hand == leftHand || hand == rightHand) {
if (hand == leftHand || hand == rightHand) {
Controller.triggerHapticPulse(_HAPTIC_STRENGTH, _HAPTIC_DURATION, hand);
}
}

View file

@ -274,16 +274,18 @@ void Web3DOverlay::onResizeWebSurface() {
_webSurface->resize(QSize(_resolution.x, _resolution.y));
}
Q_INVOKABLE int Web3DOverlay::deviceIdByTouchPoint(qreal x, qreal y)
{
const int INVALID_DEVICE_ID = -1;
Q_INVOKABLE int Web3DOverlay::deviceIdByTouchPoint(qreal x, qreal y) {
auto mapped = _webSurface->getRootItem()->mapFromGlobal(QPoint(x, y));
for (auto pair : _activeTouchPoints) {
if (mapped.x() == (int) pair.second.pos().x() && mapped.y() == (int) pair.second.pos().y())
if (mapped.x() == (int)pair.second.pos().x() && mapped.y() == (int)pair.second.pos().y()) {
return pair.first;
}
}
return -1;
return INVALID_DEVICE_ID;
}
void Web3DOverlay::render(RenderArgs* args) {