TouchscreenDevice DPI scaling now handled via JSON mapping

do the arbitrary scaling in the mapping file
This commit is contained in:
Triplelexx 2016-06-29 03:45:54 +01:00
parent efdee523fb
commit 97e90ed798
2 changed files with 2 additions and 8 deletions

View file

@ -9,7 +9,7 @@
[ "Touchscreen.DragRight" ]
]
},
"to": "Actions.Yaw"
"to": "Actions.Yaw", "filters": [ { "type": "scale", "scale": 0.12 } ]
},
{ "from": { "makeAxis" : [
@ -17,7 +17,7 @@
[ "Touchscreen.DragDown" ]
]
},
"to": "Actions.Pitch"
"to": "Actions.Pitch", "filters": [ { "type": "scale", "scale": 0.04 } ]
}
]
}

View file

@ -77,12 +77,6 @@ void TouchscreenDevice::touchBeginEvent(const QTouchEvent* event) {
_firstTouchVec = glm::vec2(point.pos().x(), point.pos().y());
KeyboardMouseDevice::enableTouch(false);
if (_screenDPI != event->window()->screen()->physicalDotsPerInch()) {
// at DPI 100 use these arbitrary values to divide dragging distance
// the value is clamped from 1 to 10 so up to 1000 DPI would be supported atm
_screenDPIScale.x = glm::clamp((float)(qApp->primaryScreen()->physicalDotsPerInchX() / 100.0), 1.0f, 10.0f)
* 600.0f;
_screenDPIScale.y = glm::clamp((float)(qApp->primaryScreen()->physicalDotsPerInchY() / 100.0), 1.0f, 10.0f)
* 200.0f;
_screenDPI = event->window()->screen()->physicalDotsPerInch();
}
}