I call UpdateTransformation() to set the global position of the object after drag within the overridden ProcessDragging(), but strange is that its attached EntityOwner seems to move at different pace than the AIS_Object.
What happens is after the object dragged, it stops interacting with my mouse.
Only after placing a new object (maybe triggering refreshment of entity owners), the highlighted entity appears in random/different position when hovering mouse over the AIS object. [see picture one]
But clicking it transport the object to where entity owner is at. [see picture two]
My guess at this problem is maybe the entity owner is moving at a different pace than the dragged AIS object, this cause the object to separate from entity?
but I can't figure out why it is so and how to fix this?
C++:
Standard_Boolean BIM_InteractiveObject::ProcessDragging(const Handle(AIS_InteractiveContext)& theCtx, const Handle(V3d_View)& theView, const Handle(SelectMgr_EntityOwner)& theOwner, const Graphic3d_Vec2i & theDragFrom, const Graphic3d_Vec2i & theDragTo, const AIS_DragAction theAction)
{
if (theAction == AIS_DragAction_Update)
{
Handle(StdSelect_ViewerSelector3d) aSelector = this->InteractiveContext()->MainSelector();
SelectMgr_SortCriterion aPickPnt;
for (int aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
if (aSelector->Picked(aPickIter) == theOwner) // filter out other SelectMgr_EntityOwner
{
aPickPnt = aSelector->PickedData(aPickIter);
break;
}
}
gp_Trsf DirTrans;
DirTrans.SetTranslation(gp_Pnt(aPickPnt.Point.X(), aPickPnt.Point.Y(), aPickPnt.Point.Z()), gp_Pnt(position_in_view.x(), position_in_view.y(), position_in_view.z()));
this->SetLocalTransformation(DirTrans);
}
else if (theAction == AIS_DragAction_Stop)
{
this->UpdateTransformation(); // should update the absolute transformation of the object
}
return true;
}
What happens is after the object dragged, it stops interacting with my mouse.
Only after placing a new object (maybe triggering refreshment of entity owners), the highlighted entity appears in random/different position when hovering mouse over the AIS object. [see picture one]
But clicking it transport the object to where entity owner is at. [see picture two]
My guess at this problem is maybe the entity owner is moving at a different pace than the dragged AIS object, this cause the object to separate from entity?
but I can't figure out why it is so and how to fix this?