mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:17:58 +02:00
TouchscreenDevice DPI scaling now handled via JSON mapping
do the arbitrary scaling in the mapping file
This commit is contained in:
parent
efdee523fb
commit
97e90ed798
2 changed files with 2 additions and 8 deletions
|
@ -9,7 +9,7 @@
|
||||||
[ "Touchscreen.DragRight" ]
|
[ "Touchscreen.DragRight" ]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"to": "Actions.Yaw"
|
"to": "Actions.Yaw", "filters": [ { "type": "scale", "scale": 0.12 } ]
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "from": { "makeAxis" : [
|
{ "from": { "makeAxis" : [
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
[ "Touchscreen.DragDown" ]
|
[ "Touchscreen.DragDown" ]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"to": "Actions.Pitch"
|
"to": "Actions.Pitch", "filters": [ { "type": "scale", "scale": 0.04 } ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,12 +77,6 @@ void TouchscreenDevice::touchBeginEvent(const QTouchEvent* event) {
|
||||||
_firstTouchVec = glm::vec2(point.pos().x(), point.pos().y());
|
_firstTouchVec = glm::vec2(point.pos().x(), point.pos().y());
|
||||||
KeyboardMouseDevice::enableTouch(false);
|
KeyboardMouseDevice::enableTouch(false);
|
||||||
if (_screenDPI != event->window()->screen()->physicalDotsPerInch()) {
|
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();
|
_screenDPI = event->window()->screen()->physicalDotsPerInch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue