From 3e2000ab472f5885de9ce1fbe1e2eb27669b5596 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 31 Oct 2014 08:54:08 +0300 Subject: [PATCH] refs #193: OCC viwer problems when move line A fix to avoid black-colored window. --- src/NewGeom/NewGeom_SalomeViewer.cpp | 5 +++++ src/XGUI/XGUI_ViewWindow.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/NewGeom/NewGeom_SalomeViewer.cpp b/src/NewGeom/NewGeom_SalomeViewer.cpp index d9ce85feb..a455bc183 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.cpp +++ b/src/NewGeom/NewGeom_SalomeViewer.cpp @@ -123,6 +123,11 @@ void NewGeom_SalomeViewer::onKeyRelease(SUIT_ViewWindow*, QKeyEvent* theEvent) void NewGeom_SalomeViewer::enableSelection(bool isEnabled) { mySelector->viewer()->enableSelection(isEnabled); + // there is a fix for a black-colored window + // the viewer rubber band is valid if the values delta is less than 1 + // TODO: remove this row after moving to SALOME 7.5 + mySelector->viewer()->setInteractionStyle(isEnabled ? SUIT_ViewModel::STANDARD + : SUIT_ViewModel::KEY_FREE); } //********************************************** diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp index b64386288..78c7f7195 100644 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ b/src/XGUI/XGUI_ViewWindow.cpp @@ -22,6 +22,8 @@ #include #include +#include + #define BORDER_SIZE 2 const char* imageZoomCursor[] = { "32 32 3 1", ". c None", "a c #000000", "# c #ffffff", @@ -871,6 +873,16 @@ void XGUI_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) */ void XGUI_ViewWindow::drawRect() { + // there is a fix for a black-colored window + // the rubber band is valid if the values delta is less than 1 + // TODO: move this fix to the RectRubberBand according to SALOME 7.5 + double aDeltaX = fabs((float)(myStartX-myCurrX)); + double aDeltaY = fabs((float)(myStartY-myCurrY)); + if (aDeltaX <= 1 || aDeltaY == 1) { + endDrawRect(); + return; + } + if (!myRectBand) { myRectBand = new XGUI_RectRubberBand(myViewPort); } -- 2.39.2