Skip to content

Commit

Permalink
3 to 4 (#916)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashton Larkin <[email protected]>
  • Loading branch information
adlarkin committed Jul 13, 2021
2 parents e3fbbcd + 15b456b commit 488cc87
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/ignition/gazebo/Types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace ignition
static const ComponentId kComponentIdInvalid = -1;

/// \brief Id that indicates an invalid component type.
static const ComponentTypeId kComponentTypeIdInvalid = -1;
static const ComponentTypeId kComponentTypeIdInvalid = UINT64_MAX;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/ignition/gazebo/components/Sensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace gazebo
inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
namespace components
{
/// \brief A component that identifies an entity as being a link.
/// \brief A component that identifies an entity as being a sensor.
using Sensor = Component<NoData, class SensorTag>;
IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.Sensor", Sensor)

Expand Down
17 changes: 15 additions & 2 deletions src/gui/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
public: rendering::RayQueryPtr rayQuery;

/// \brief View control focus target
public: math::Vector3d target;
public: math::Vector3d target = math::Vector3d(
math::INF_D, math::INF_D, math::INF_D);

/// \brief Rendering utility
public: RenderUtil renderUtil;
Expand Down Expand Up @@ -1603,12 +1604,24 @@ void IgnRenderer::HandleMouseViewControl()
}
else
{
if (this->dataPtr->mouseEvent.Type() == common::MouseEvent::PRESS)
if (this->dataPtr->mouseEvent.Type() == common::MouseEvent::PRESS ||
// the rendering thread may miss the press event due to
// race condition when doing a drag operation (press and move, where
// the move event overrides the press event before it is processed)
// so we double check to see if target is set or not
(this->dataPtr->mouseEvent.Type() == common::MouseEvent::MOVE &&
this->dataPtr->mouseEvent.Dragging() &&
std::isinf(this->dataPtr->target.X())))
{
this->dataPtr->target = this->ScreenToScene(
this->dataPtr->mouseEvent.PressPos());
this->dataPtr->viewControl.SetTarget(this->dataPtr->target);
}
// unset the target on release (by setting to inf)
else if (this->dataPtr->mouseEvent.Type() == common::MouseEvent::RELEASE)
{
this->dataPtr->target = ignition::math::INF_D;
}

// Pan with left button
if (this->dataPtr->mouseEvent.Buttons() & common::MouseEvent::LEFT)
Expand Down

0 comments on commit 488cc87

Please sign in to comment.