Added zooming in mouseview with rightclick+mousewheel. Code provided by Charlice Yao, NaCL
parent
484c686e16
commit
a6a52fa63a
|
|
@ -16386,5 +16386,49 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>_NACL_MLDefFov</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>default field of view for right mouse zoom</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>_NACL_MLFov</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>1=norm, under1 zoom out, over1 zoom in</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1</real>
|
||||
</map>
|
||||
<key>_NACL_MLActive</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>mouselook</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>_NACL_MLRightMouseDOwn</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>insert rude comment here</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@
|
|||
#include "llfloatertools.h"
|
||||
#include "llviewercontrol.h"
|
||||
|
||||
// NaCl - Mousewheel zoom - Moy Loon
|
||||
#include "llviewercamera.h"
|
||||
// NaCl End
|
||||
|
||||
const S32 BUTTON_HEIGHT = 16;
|
||||
const S32 BUTTON_WIDTH_SMALL = 32;
|
||||
const S32 BUTTON_WIDTH_BIG = 48;
|
||||
|
|
@ -777,6 +781,16 @@ void LLToolCompGun::handleDeselect()
|
|||
|
||||
BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks)
|
||||
{
|
||||
// NaCl - Mousewheel zoom - Moy Loon
|
||||
if(gSavedSettings.getBOOL("_NACL_MLActive")==1)
|
||||
{
|
||||
if(clicks>0)gSavedSettings.setF32("_NACL_MLFov",gSavedSettings.getF32("_NACL_MLFov")/1.1);
|
||||
if(clicks<0)gSavedSettings.setF32("_NACL_MLFov",gSavedSettings.getF32("_NACL_MLFov")*1.1);
|
||||
LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("_NACL_MLDefFov")/gSavedSettings.getF32("_NACL_MLFov"));
|
||||
return TRUE;
|
||||
}
|
||||
// NaCl End
|
||||
|
||||
if (clicks > 0)
|
||||
{
|
||||
gAgentCamera.changeCameraToDefault();
|
||||
|
|
|
|||
|
|
@ -980,6 +980,17 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
|||
|
||||
BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||
{
|
||||
// NaCl - Mousewheel zoom - Moy Loon
|
||||
gSavedSettings.setBOOL("_NACL_MLRightMouseDown",1);
|
||||
if(gAgentCamera.cameraMouselook()&&gSavedSettings.getBOOL("_NACL_MLActive")==0)
|
||||
{
|
||||
gSavedSettings.setBOOL("_NACL_MLActive",1);
|
||||
F32 deffov=LLViewerCamera::getInstance()->getDefaultFOV();
|
||||
gSavedSettings.setF32("_NACL_MLDefFov",deffov);
|
||||
LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("_NACL_MLDefFov")/gSavedSettings.getF32("_NACL_MLFov"));
|
||||
}
|
||||
// NaCl End
|
||||
|
||||
S32 x = pos.mX;
|
||||
S32 y = pos.mY;
|
||||
x = llround((F32)x / mDisplayScale.mV[VX]);
|
||||
|
|
@ -1006,6 +1017,16 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
|
|||
|
||||
BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||
{
|
||||
// NaCl - Mousewheel zoom - Moy Loon
|
||||
gSavedSettings.setBOOL("NACL_MLRightMouseDown",0);
|
||||
if(gSavedSettings.getBOOL("_NACL_MLActive")==1)
|
||||
{
|
||||
gSavedSettings.setBOOL("_NACL_MLActive",0);
|
||||
LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("_NACL_MLDefFov"));
|
||||
}
|
||||
// NaCl End
|
||||
|
||||
|
||||
BOOL down = FALSE;
|
||||
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue