DiscussionsIssue archiveOCCT:Visualization

Archived issue #0033746

Visualization - Unexpected moving with AIS_ViewCube

CommunityOCCT:Visualizationverified9 public notes

Search issues

Description

Issue when AIS_ViewCube set to Top and AIS_ViewController bind MouseGesture with AIS_MouseGesture_RotateView

The steps about the issue are as follows:
First, In class AIS_ViewController add MouseGesture AIS_MouseGesture_RotateView to myMouseGestureMap in its constructor function.
Second, Create as AIS_ViewCube object in OCC_3dView
Third, draw a box and click the top of the AIS_ViewCube object.
The last, when begin to rotate view, the view will auto rotate with angle PI/2.

sample code :
void OCC_3dView::ShowViewCube()
{
Handle(AIS_ViewCube) aisViewCube = new AIS_ViewCube();
Handle(AIS_InteractiveContext) aisContext = GetAISContext();

aisContext->SetDisplayMode(AIS_Shaded, true);
aisViewCube->SetBoxSideLabel(V3d_Xpos, L"右");
aisViewCube->SetBoxSideLabel(V3d_Ypos, L"后");
aisViewCube->SetBoxSideLabel(V3d_Zpos, L"上");
aisViewCube->SetBoxSideLabel(V3d_Xneg, L"左");
aisViewCube->SetBoxSideLabel(V3d_Yneg, L"前");
aisViewCube->SetBoxSideLabel(V3d_Zneg, L"下");
Quantity_Color viewCubeTextColor;
viewCubeTextColor.SetValues(0 / 255., 0 / 255., 0 / 255., Quantity_TOC_RGB);
aisViewCube->SetTextColor(viewCubeTextColor);
aisViewCube->SetFontHeight(28);
aisViewCube->SetFont(L"Microsoft YaHei");
aisViewCube->SetSize(60, false);
aisViewCube->SetDrawAxes(false);
Quantity_Color viewCubeColor;
viewCubeColor.SetValues(183 / 255., 194 / 255., 213 / 255., Quantity_TOC_RGB);
aisViewCube->SetColor(viewCubeColor);
aisViewCube->SetResetCamera(true);
aisContext->Display(aisViewCube, Standard_True);
}

AIS_ViewController::AIS_ViewController()
{
...
myMouseGestureMap.Bind((Standard_UInteger)Aspect_VKeyMouse_RightButton | (Standard_UInteger)Aspect_VKeyFlags_SHIFT,
AIS_MouseGesture_RotateView);
...
}

With My Best Regard.

Steps to reproduce

pload MODELING VISUALIZATION
box b 0 0 -100 100 90 10
vinit View1
vaxo
vdisplay -dispMode 1 b
vfit
vviewcube c
vcamera -navmode fly

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Wed Jul 17 13:21:43 2024 +0100

    0033746: Visualization - Unexpected moving with AIS_ViewCube
    
    Fixed angle calculation for view rotation.
    Added draw command vmousebutton to test mouse button events.
02Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
03Commenter 3
04Commenter 4
The same issue can be reproduced for other sides of view cube as well. It seems like after using of view cube it tries to orient camera in the way where words on its sides is readable and horizontal. For example in the same setup with box we can click "FRONT" -> "TOP" -> "RIGHT" (using edges connecting it). After this the word "RIGHT" on cube is vertical. Moving camera in view would produce the same unexpected rotation.
05Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
06Commenter 3
Please review CR33746
07Commenter 3
Attachment 1 (PNG) (26,152 bytes)   
08Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: sshutina
Date: Mon Sep 15 17:00:53 2025 +0100

    Rebase 0033746: Visualization - Unexpected moving with AIS_ViewCube
    
    Fixed angle calculation for view rotation.
    Added draw command vmousebutton to test mouse button events.
09Commenter 5