From d965af2b0cbf62e2e1601f504e0d548da40aa742 Mon Sep 17 00:00:00 2001
From: AndreyL ProductEngine <alihatskiy@productengine.com>
Date: Fri, 24 Aug 2018 02:40:12 +0300
Subject: [PATCH] MAINT-9032 Virtual Track Ball improvements

---
 indra/llui/llvirtualtrackball.cpp             |  31 ++++++++++++++++++
 indra/llui/llvirtualtrackball.h               |   5 +++
 .../skins/default/textures/textures.xml       |   4 +++
 .../track_control_rotate_bottom_active.png    | Bin 0 -> 362 bytes
 .../track_control_rotate_left_side_active.png | Bin 0 -> 340 bytes
 ...track_control_rotate_right_side_active.png | Bin 0 -> 358 bytes
 .../track_control_rotate_top_active.png       | Bin 0 -> 367 bytes
 .../xui/en/widgets/sun_moon_trackball.xml     |  16 ++++-----
 8 files changed, 48 insertions(+), 8 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png
 create mode 100644 indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png
 create mode 100644 indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png
 create mode 100644 indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png

diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp
index e73bba57bb4..723643dd251 100644
--- a/indra/llui/llvirtualtrackball.cpp
+++ b/indra/llui/llvirtualtrackball.cpp
@@ -88,6 +88,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p)
     btn_rt.rect(LLRect(centerX - axis_offset_lt, border_rect.mTop, centerX + axis_offset_rb, border_rect.mTop - btn_size));
     btn_rt.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopClick, this));
     btn_rt.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopClick, this));
+    btn_rt.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopMouseEnter, this));
     mBtnRotateTop = LLUICtrlFactory::create<LLButton>(btn_rt);
     addChild(mBtnRotateTop);
 
@@ -104,6 +105,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p)
     btn_rr.rect(LLRect(border_rect.mRight - btn_size, centerY + axis_offset_lt, border_rect.mRight, centerY - axis_offset_rb));
     btn_rr.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightClick, this));
     btn_rr.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightClick, this));
+    btn_rr.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightMouseEnter, this));
     mBtnRotateRight = LLUICtrlFactory::create<LLButton>(btn_rr);
     addChild(mBtnRotateRight);
 
@@ -120,6 +122,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p)
     btn_rb.rect(LLRect(centerX - axis_offset_lt, border_rect.mBottom + btn_size, centerX + axis_offset_rb, border_rect.mBottom));
     btn_rb.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomClick, this));
     btn_rb.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomClick, this));
+    btn_rb.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomMouseEnter, this));
     mBtnRotateBottom = LLUICtrlFactory::create<LLButton>(btn_rb);
     addChild(mBtnRotateBottom);
 
@@ -136,6 +139,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p)
     btn_rl.rect(LLRect(border_rect.mLeft, centerY + axis_offset_lt, border_rect.mLeft + btn_size, centerY - axis_offset_rb));
     btn_rl.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftClick, this));
     btn_rl.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftClick, this));
+    btn_rl.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftMouseEnter, this));
     mBtnRotateLeft = LLUICtrlFactory::create<LLButton>(btn_rl);
     addChild(mBtnRotateLeft);
 
@@ -228,6 +232,13 @@ void LLVirtualTrackball::draw()
         gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], mImgSunFront->getWidth() / 2, 12, false);
     }
 
+    // hide the direction labels when disabled
+    BOOL enabled = isInEnabledChain();
+    mLabelN->setVisible(enabled);
+    mLabelE->setVisible(enabled);
+    mLabelS->setVisible(enabled);
+    mLabelW->setVisible(enabled);
+
     LLView::draw();
 }
 
@@ -283,6 +294,26 @@ void LLVirtualTrackball::onRotateRightClick()
     }
 }
 
+void LLVirtualTrackball::onRotateTopMouseEnter()
+{
+    mBtnRotateTop->setHighlight(true);
+}
+
+void LLVirtualTrackball::onRotateBottomMouseEnter()
+{
+    mBtnRotateBottom->setHighlight(true);
+}
+
+void LLVirtualTrackball::onRotateLeftMouseEnter()
+{
+    mBtnRotateLeft->setHighlight(true);
+}
+
+void LLVirtualTrackball::onRotateRightMouseEnter()
+{
+    mBtnRotateRight->setHighlight(true);
+}
+
 void LLVirtualTrackball::setValue(const LLSD& value)
 {
 	if (value.isArray() && value.size() == 4)
diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h
index 48ddb7f4d95..2d4b1ece176 100644
--- a/indra/llui/llvirtualtrackball.h
+++ b/indra/llui/llvirtualtrackball.h
@@ -130,6 +130,11 @@ class LLVirtualTrackball
     void onRotateLeftClick();
     void onRotateRightClick();
 
+    void onRotateTopMouseEnter();
+    void onRotateBottomMouseEnter();
+    void onRotateLeftMouseEnter();
+    void onRotateRightMouseEnter();
+
     S32 mPrevX;
     S32 mPrevY;
 
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index a177dbadd5b..176fbd49e99 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -695,6 +695,10 @@ with the same filename but different name
   <texture name="VirtualTrackball_Rotate_Left" file_name="widgets/track_control_rotate_left_side.png" />
   <texture name="VirtualTrackball_Rotate_Right" file_name="widgets/track_control_rotate_right_side.png" />
   <texture name="VirtualTrackball_Rotate_Top" file_name="widgets/track_control_rotate_top.png" />
+  <texture name="VirtualTrackball_Rotate_Bottom_Active" file_name="widgets/track_control_rotate_bottom_active.png" />
+  <texture name="VirtualTrackball_Rotate_Left_Active" file_name="widgets/track_control_rotate_left_side_active.png" />
+  <texture name="VirtualTrackball_Rotate_Right_Active" file_name="widgets/track_control_rotate_right_side_active.png" />
+  <texture name="VirtualTrackball_Rotate_Top_Active" file_name="widgets/track_control_rotate_top_active.png" />
   <texture name="VirtualTrackball_Sphere" file_name="widgets/track_control_sphere.png" />
   <texture name="VirtualTrackball_Sun_Back" file_name="widgets/track_control_sun_back.png" />
   <texture name="VirtualTrackball_Sun_Front" file_name="widgets/track_control_sun_front.png" />
diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_bottom_active.png
new file mode 100644
index 0000000000000000000000000000000000000000..911618b08e609b189315de99ad1771091e120eb8
GIT binary patch
literal 362
zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D_1*43o
zi(^Q|t>gp=tq1q_*YDe6Vk6!0pSe&>m#3WZ(ft5!hb`Quyy47`z6Tsm{2}WxN2-mR
z>7%d7;Y0})J&(?ZIu3i-+aDV2kzUdl!@W$%K&EYZkd#l)4W4CbD#jOYF-hu(*(_Yf
zDi@)1qjB8{o(}E{8$>6HO-b6gfIW7iff#pE=avT&V%%#sX!0CS>QrGoymf;_o$QoN
z8#J#SOls6-<gVHn5zwQber!SH1m+`57FWEPKdPG?mS-}ww-e`d<aOPqBGP_qYedX@
z51%EO$(&luCZ_))c;-8J-TLOTS%JSJbU{&&!yk#WA8H-WxOTCgameXU^HkFK$@nqY
z<nVMxL+hP8L*zQ<I#e=s{BHOmJ?Y?rFY+u}-4boK3=A<U`z9zRCC>*29)qW=pUXO@
GgeCyVu7LRf

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_left_side_active.png
new file mode 100644
index 0000000000000000000000000000000000000000..2fe04b93f1f04879f5a27175b7316c8f13260804
GIT binary patch
literal 340
zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D_1tXiM
zi(^Q|t>gp=j}Pzf+lwh&V|-K)C85W1#Lyvz;m{Q`nJ2GgW;_hp%#a~qEKsc^?UT#>
zW}~E^D0f5KiDW|w5ubGqI-b1Tb1w4mvnDZSx#{Q}eZshrQFl_RzJNN@Mx(VxSIrf+
zElFMXm;Z?W3ZaD+It&kwJG^n{=I&FDWIB}H5Yfd^8|;`WW+=w8IFjLz{KARrT@O6p
z-54=p0;`Y19+_@cgBqR=@5UR<9jOamNltu{&$LlW(fdYYg}t0N$HQ`mH%=#n^c3cK
zG^*}zwCKLE=&>NH*iWHkPJ01y=8vVTelwg^3P_1!EaVq>-;m}JQ~1DVH4m4U>#8kU
jjAg-FGt^bpnHeNZrWMV7|Nkp6m>4`={an^LB{Ts5Aggo{

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_right_side_active.png
new file mode 100644
index 0000000000000000000000000000000000000000..824051562fa7bacc87de245c2cd244ed88d1d31c
GIT binary patch
literal 358
zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D_1*3$g
zi(^Q|t>gp+=0Cr``_E{c#*pF2DA3NlkxyXrg;PuteT+$pQBe$sEFISPdUGe-n5^Z<
zW}?E^uUdBHQ>%)=Zl*##G4CfUC1aW#WZKdig|{lt73|<`u#nGk)LHwfol8KSsZd|n
zc%iC5{o<()7j)D!9r>S`xI<sSo=MVg3af+b8V8$Rj?y59J#1+PBJ!$BJUKePKPu)7
z@Z%Pl>F|f~Y=HpZk@Ou_0{7j5&Tt$xa(KgdMAe~&r+cBn9+4$-(;u$0h;h-m$9yDb
z2hVx7NA@XFJWRq3GlZu<loQ$Ui&4N@XmXav*Mp%7dQ3@nL6?j)`0hRCU<zQn#dzed
zLyoIw8{^VN(Jtu{M!JGc%R2sV(b>{*>SPN8L+<}o)tU-Mvw#7|;OXk;vd$@?2>=RX
Bc|`yK

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png b/indra/newview/skins/default/textures/widgets/track_control_rotate_top_active.png
new file mode 100644
index 0000000000000000000000000000000000000000..9a7493703bf0406316f1c0580405a0d62aa60ef1
GIT binary patch
literal 367
zcmV-#0g(QQP)<h;3K|Lk000e1NJLTq000;O000;W1^@s6;CDUv00009a7bBm000XU
z000XU0RWnu7ytkPAxT6*RCwBBU>LUG-@ktfK<os>F+ki4#9x8<KNKGW;vgVqB*$PD
zAhrkM0wkOW#1=sO1j!N*UJAr)q*~yGW_Ugjt3c%>f%p-cC3}IGlUT#G(F_M+12i?h
zXcmC*1Y!&q0^%Gr!$Yx!Gf->|ngt->NGRN6(G1T8VnH10rGWSYnk5f_m=Bi)I#`0n
zm4J_Xu>@5SF2&(kERZB%ffg1Eu3}RtjK%OcA``_iES6ZID>B1kffbP!lwh%-o0_@Z
z1B(SasA+)=77LzG(*i~;7W|{N1^=mG@HA`&W5H9&wSX0f_Yg1~B+p8TFF<A2EgXj5
z!d1+WYKb}!zeh71#8;<gM7sj<AE@CV+JzR?Yc|w^Y+Bagego2Y008X(zKR1En?V2o
N002ovPDHLkV1i_0hnfHY

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml b/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml
index 3a9655b3174..0e729c821a0 100644
--- a/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml
+++ b/indra/newview/skins/default/xui/en/widgets/sun_moon_trackball.xml
@@ -43,26 +43,26 @@
     <sun_moon_trackball.button_rotate_top
         name="btn_rotate_top"
         image_unselected="VirtualTrackball_Rotate_Top"
-        image_selected="VirtualTrackball_Rotate_Top"
-        image_disabled="VirtualTrackball_Rotate_Top" />
+        image_selected="VirtualTrackball_Rotate_Top_Active"
+        image_disabled="Blank" />
 
     <sun_moon_trackball.button_rotate_bottom
         name="btn_rotate_bottom"
         image_unselected="VirtualTrackball_Rotate_Bottom"
-        image_selected="VirtualTrackball_Rotate_Bottom"
-        image_disabled="VirtualTrackball_Rotate_Bottom" />
+        image_selected="VirtualTrackball_Rotate_Bottom_Active"
+        image_disabled="Blank" />
 
     <sun_moon_trackball.button_rotate_left
         name="btn_rotate_left"
         image_unselected="VirtualTrackball_Rotate_Left"
-        image_selected="VirtualTrackball_Rotate_Left"
-        image_disabled="VirtualTrackball_Rotate_Left" />
+        image_selected="VirtualTrackball_Rotate_Left_Active"
+        image_disabled="Blank" />
 
     <sun_moon_trackball.button_rotate_right
         name="btn_rotate_right"
         image_unselected="VirtualTrackball_Rotate_Right"
-        image_selected="VirtualTrackball_Rotate_Right"
-        image_disabled="VirtualTrackball_Rotate_Right" />
+        image_selected="VirtualTrackball_Rotate_Right_Active"
+        image_disabled="Blank" />
 
 </sun_moon_trackball>
 
-- 
GitLab