]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
adds method GetSelectionEventFlipY() that does not change Y-coordinate in SelectionEvent
authorpkv <pkv@opencascade.com>
Mon, 19 Sep 2005 10:39:44 +0000 (10:39 +0000)
committerpkv <pkv@opencascade.com>
Mon, 19 Sep 2005 10:39:44 +0000 (10:39 +0000)
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_InteractorStyle.h

index 704e8d907d14d0480cf50edcd18f8d526cc40dd1..8a1b758f6934c7f6c5759258eb52ff7ed909db57 100644 (file)
@@ -171,7 +171,24 @@ SVTK_InteractorStyle
 
   return aSelectionEvent;
 }
+//----------------------------------------------------------------------------
+SVTK_SelectionEvent
+SVTK_InteractorStyle
+::GetSelectionEventFlipY()
+{
+  SVTK_SelectionEvent aSelectionEvent;
+  int x, y;
 
+  //GetEventPosition( this->Interactor, x, y );
+  Interactor->GetEventPosition(x, y);
+  aSelectionEvent.myX = x;
+  aSelectionEvent.myY = y;
+  aSelectionEvent.myIsCtrl = Interactor->GetControlKey();
+  aSelectionEvent.myIsShift = Interactor->GetShiftKey();
+  aSelectionEvent.mySelectionMode = GetSelector()->SelectionMode();
+
+  return aSelectionEvent;
+}
 //----------------------------------------------------------------------------
 void
 SVTK_InteractorStyle
@@ -895,7 +912,7 @@ SVTK_InteractorStyle
 
           myPicker->Pick(x, y, 0.0, GetCurrentRenderer());
          if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(myPicker->GetActor())){
-           SVTK_SelectionEvent aSelectionEvent = GetSelectionEvent();
+           SVTK_SelectionEvent aSelectionEvent = GetSelectionEventFlipY();
            aSelectionEvent.mySelectionMode = aSelectionMode;
            aSelectionEvent.myIsRectangle = false;
            aSActor->Highlight( GetSelector(), this, aSelectionEvent, true );
@@ -929,13 +946,11 @@ SVTK_InteractorStyle
 
          myRectPicker->SetTolerance(0.001);
          myRectPicker->Pick(x1, y1, 0.0, x2, y2, 0.0, GetCurrentRenderer());
-
-         SVTK_SelectionEvent aSelectionEvent = GetSelectionEvent();
+         SVTK_SelectionEvent aSelectionEvent = GetSelectionEventFlipY();
          aSelectionEvent.mySelectionMode = aSelectionMode;
          aSelectionEvent.myIsRectangle = true;
          aSelectionEvent.myLastX = x1;
          aSelectionEvent.myLastY = y1;
-         
          vtkActorCollection* aListActors = myRectPicker->GetActors();
          aListActors->InitTraversal();
          while(vtkActor* aActor = aListActors->GetNextActor()){
index a1e5158f971ed731de5b8de5fcd353d3cc8a5902..6f98dd48ca5452064881bbfe49941dad064a1a50 100644 (file)
@@ -70,7 +70,7 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle
   virtual int GetState();
 
   SVTK_SelectionEvent GetSelectionEvent();
-
+  SVTK_SelectionEvent GetSelectionEventFlipY();
   // redefined in order to add an observer (callback) for custorm event (space mouse event)
   virtual void SetInteractor( vtkRenderWindowInteractor* );
 
@@ -180,7 +180,6 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle
   // [5] Dominant Combined Switch
   
   QWidget*                  myRenderWidget;
-  vtkSmartPointer<SVTK_Selector> mySelector;
   vtkSmartPointer<SVTK_GenericRenderWindowInteractor> myInteractor;
 
   vtkSmartPointer<vtkPicker> myPicker;