Calling a function when zoom level has changed?
Hi guys,
Is it possible to call a function when the zoom level has changed? I try to avoid using "OnUpdate" aiming at performance optimization. |
I'd check what keybind is used for the zoom in and zoom out at the controls, chck that at the lua file where the settings menu for those controls are created (keybindings) and check what function is used there.
Maybe you can use ZO_PreHook or SecurePostHook on it to react on the zoom change then. esoui/ingame/globals/bindings.xml <Category name="SI_KEYBINDINGS_CATEGORY_CAMERA"> <Action name="CAMERA_ZOOM_OUT"> <Down>CameraZoomOut()</Down> </Action> <Action name="CAMERA_ZOOM_IN"> <Down>CameraZoomIn()</Down> </Action> Func names are CameraZoomIn and CameraZoomOut Test if they are protected via IsProtectedFunction("CameraZoomIn") or not. Looks like it isn't so a SecurePostHook should/could work. Lua Code:
Yep, tested, works |
Thanks Beatram,
I forgot to mention that was for the map zoom, I tried "WorldMapZoom" and many other things without success. "ZO_WorldMapZoomMinus_OnClicked" and "ZO_WorldMapZoomPlus_OnClicked" work but only when you click the + and - button of the zoom. "ZO_WorldMapZoom_OnMouseWheel" doesn't work edit: ah : "ZO_WorldMap_MouseWheel" works! :banana: |
Try function ZO_MapPanAndZoom:SetCurrentNormalizedZoomInternal(normalizedZoom)
It seems to be called from internal local functions as you click the zoom slider and maybe also if you use the mousewheel as it is called from different zoom functions there (normalized, curved etc.) The object is stored in the local g_mapPanAndZoom which is returned by function ZO_WorldMap_GetPanAndZoom() Lua Code:
If this is not the correct one that will fire as you use the mouse wheel check any other of the update/set functions there, e.g. :OnMouseWheel(delta) which will call AddZoomDelta which calls SetLockedNormalizedZoom which calls SetTargetNormalizedZoom |
Thanks again, it works wonderfully :)
|
All times are GMT -6. The time now is 05:52 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI