Hi,
I am experiencing a bug with ‘vtkHoverWidget’. When I have the Hoverwidget switched off, the mouse behaviour works fine (as with ‘vtkInteractorStyleImage’), but if I instead switch it off, then on, then off again, then the mouse behaviour is a bit strange, there is what I would call a “drift” while moving the view. Here is my code (minimal example), where the only visible object is a triangle.
I would be very grateful for some help with this issue.
[My installed VTK version is 6.3.0]
File “billiards.cxx”
#include <vtkSmartPointer.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleImage.h>
#include <vtkHoverWidget.h>
#include <vtkProperty.h>
int main(){
//Draw a triangle
auto boundaryPoints = vtkSmartPointer<vtkPoints>::New();
boundaryPoints->SetNumberOfPoints(3);
boundaryPoints->SetPoint(0, -1, -1, 0);
boundaryPoints->SetPoint(1, 1, -1, 0);
boundaryPoints->SetPoint(2, 1, 1, 0);
auto boundaryLines = vtkSmartPointer<vtkCellArray>::New();
boundaryLines->InsertNextCell(4);
boundaryLines->InsertCellPoint(0);
boundaryLines->InsertCellPoint(1);
boundaryLines->InsertCellPoint(2);
boundaryLines->InsertCellPoint(0);
auto boundary = vtkSmartPointer<vtkPolyData>::New();
boundary->SetPoints(boundaryPoints);
boundary->SetLines(boundaryLines);
auto boundaryMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
boundaryMapper->SetInputData(boundary);
boundaryMapper->Update();
auto boundaryActor = vtkSmartPointer<vtkActor>::New();
boundaryActor->SetMapper(boundaryMapper);
boundaryActor->GetProperty()->SetColor(1,1,1);
auto myTableRenderer = vtkSmartPointer<vtkRenderer>::New();
myTableRenderer->AddActor(boundaryActor);
myTableRenderer->SetBackground(0,0,0);
auto renWin =vtkSmartPointer<vtkRenderWindow>::New();
renWin->AddRenderer(myTableRenderer);
renWin->SetSize(10000,2000);
auto iren =vtkSmartPointer<vtkRenderWindowInteractor>::New();
iren->SetRenderWindow(renWin);
auto style = vtkSmartPointer<vtkInteractorStyleImage>::New();
iren->SetInteractorStyle( style );
iren->Initialize();
//Set up hoverwidget
auto hoverWidget = vtkSmartPointer<vtkHoverWidget>::New();
hoverWidget->SetInteractor(iren);
hoverWidget->SetTimerDuration(1);
//Switching hoverwidget on and off
hoverWidget->Off();
// /*
hoverWidget->On();
hoverWidget->Off();
// */
iren->Start();
return EXIT_SUCCESS;
}
File “CMakeLists.txt”
cmake_minimum_required(VERSION 2.8)
PROJECT(Billiards)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(billiards MACOSX_BUNDLE billiards.cxx)
target_link_libraries(billiards ${VTK_LIBRARIES})