Commit 7c7c2666 authored by Zain Selman's avatar Zain Selman 💬
Browse files

adjusts click coordinates according to DPR

parent 9efdca1d
......@@ -1271,9 +1271,11 @@ void SelectionBasePlugin::slotMouseLassoSelection(QMouseEvent* _event) {
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
int y = PluginFunctions::viewerProperties().glState().context_height() - _event->pos().y();
if (!PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(), node_idx, target_idx, &hit_point))
hit_point = PluginFunctions::viewerProperties().glState().unproject(ACG::Vec3d(_event->pos().x(), y, 0.5));
const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
int y = PluginFunctions::viewerProperties().glState().context_height() - event_pos.y();
if (!PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, event_pos, node_idx, target_idx, &hit_point))
hit_point = PluginFunctions::viewerProperties().glState().unproject(ACG::Vec3d(event_pos.x(), y, 0.5));
// Do rendering of mouse tool...
if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
......@@ -1338,9 +1340,11 @@ void SelectionBasePlugin::slotMouseVolumeLassoSelection(QMouseEvent* _event) {
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
int y = PluginFunctions::viewerProperties().glState().context_height() - _event->pos().y();
if (!PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(), node_idx, target_idx, &hit_point))
hit_point = PluginFunctions::viewerProperties().glState().unproject(ACG::Vec3d(_event->pos().x(), y, 0.5));
const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
int y = PluginFunctions::viewerProperties().glState().context_height() - event_pos.y();
if (!PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, event_pos, node_idx, target_idx, &hit_point))
hit_point = PluginFunctions::viewerProperties().glState().unproject(ACG::Vec3d(event_pos.x(), y, 0.5));
// Do rendering of mouse tool...
if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
......@@ -1410,6 +1414,8 @@ void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
// Ignore context menu for sphere selection
if (_event->button() == Qt::RightButton) return;
const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
// Do rendering of mouse tool...
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
......@@ -1419,7 +1425,7 @@ void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
// Pick anything to find all possible objects
if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING,
_event->pos(), node_idx, target_idx, &hit_point)) {
event_pos, node_idx, target_idx, &hit_point)) {
BaseObjectData* object = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment