Skip to content
Snippets Groups Projects

adjusts click coordinates according to DPR

Closed Zain Selman requested to merge zs/hdr_fix into master
1 file
+ 13
7
Compare changes
  • Side-by-side
  • Inline
+ 13
7
@@ -1271,9 +1271,11 @@ void SelectionBasePlugin::slotMouseLassoSelection(QMouseEvent* _event) {
@@ -1271,9 +1271,11 @@ void SelectionBasePlugin::slotMouseLassoSelection(QMouseEvent* _event) {
size_t node_idx, target_idx;
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
ACG::Vec3d hit_point;
int y = PluginFunctions::viewerProperties().glState().context_height() - _event->pos().y();
const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
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));
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...
// Do rendering of mouse tool...
if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
@@ -1338,9 +1340,11 @@ void SelectionBasePlugin::slotMouseVolumeLassoSelection(QMouseEvent* _event) {
@@ -1338,9 +1340,11 @@ void SelectionBasePlugin::slotMouseVolumeLassoSelection(QMouseEvent* _event) {
size_t node_idx, target_idx;
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
ACG::Vec3d hit_point;
int y = PluginFunctions::viewerProperties().glState().context_height() - _event->pos().y();
const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
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));
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...
// Do rendering of mouse tool...
if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
if(_event->type() == QEvent::MouseButtonPress && _event->button() == Qt::LeftButton) {
@@ -1410,6 +1414,8 @@ void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
@@ -1410,6 +1414,8 @@ void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
// Ignore context menu for sphere selection
// Ignore context menu for sphere selection
if (_event->button() == Qt::RightButton) return;
if (_event->button() == Qt::RightButton) return;
 
const QPoint event_pos = PluginFunctions::adjustForDevicePixelRatio(_event->pos());
 
// Do rendering of mouse tool...
// Do rendering of mouse tool...
size_t node_idx, target_idx;
size_t node_idx, target_idx;
ACG::Vec3d hit_point;
ACG::Vec3d hit_point;
@@ -1419,7 +1425,7 @@ void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
@@ -1419,7 +1425,7 @@ void SelectionBasePlugin::slotMouseSphereSelection(QMouseEvent* _event) {
// Pick anything to find all possible objects
// Pick anything to find all possible objects
if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING,
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;
BaseObjectData* object = 0;
Loading