Move keybind to lua, and setting to prefs

This commit is contained in:
robin 2021-05-02 12:48:54 +02:00
parent bb00b9b018
commit 954c8c85c3
4 changed files with 19 additions and 10 deletions

View File

@ -60,7 +60,7 @@ local function OnDataUpdate()
end end
end end
function zzCoords_MinimapToggle() local function zzCoords_MinimapToggle()
if(MinimapCluster:IsVisible()) then if(MinimapCluster:IsVisible()) then
MinimapCluster:Hide() MinimapCluster:Hide()
else else
@ -122,8 +122,11 @@ child['specs'] = {
} }
function events:PLAYER_ENTERING_WORLD(event) function events:PLAYER_ENTERING_WORLD(event)
child:UnregisterEvent('PLAYER_ENTERING_WORLD') child:UnregisterEvent('PLAYER_ENTERING_WORLD')
BINDING_HEADER_COORDS = childName local m = CreateFrame("BUTTON", "zzCoords_MinimapToggleFrame")
BINDING_NAME_COORDS_TOGGLE = L["Toggle Minimap"] m:SetScript("OnClick", zzCoords_MinimapToggle)
if(db['toggleMap'] and db['toggleMap'] ~= '') then
SetBinding(db['toggleMap'], "CLICK zzCoords_MinimapToggleFrame:LeftButton")
end
child:RegisterEvent({"ZONE_CHANGED_NEW_AREA","ZONE_CHANGED","ZONE_CHANGED_INDOORS","NEW_WMO_CHUNK"}, child.ZoneEvent) child:RegisterEvent({"ZONE_CHANGED_NEW_AREA","ZONE_CHANGED","ZONE_CHANGED_INDOORS","NEW_WMO_CHUNK"}, child.ZoneEvent)
child:RegisterEvent({"PLAYER_STARTED_MOVING", "PLAYER_STOPPED_MOVING"}, child.MoveEvent) child:RegisterEvent({"PLAYER_STARTED_MOVING", "PLAYER_STOPPED_MOVING"}, child.MoveEvent)
end end

View File

@ -17,7 +17,7 @@ if L then
L['HINT4'] = "|c0000ff00Shift-Rechtsklick|r |c00ffffffschaltet Minimap an/aus|r" L['HINT4'] = "|c0000ff00Shift-Rechtsklick|r |c00ffffffschaltet Minimap an/aus|r"
L['Show Zone'] = "Zeige Zone" L['Show Zone'] = "Zeige Zone"
L['Show Subzone'] = "Zeige Subzone" L['Show Subzone'] = "Zeige Subzone"
L["Toggle Minimap"] = "Minimap ein-/ausschalten" L["Toggle Minimap"] = "Minimap ein-/ausblenden"
L['Max Length'] = "Max. L\195\164nge" L['Max Length'] = "Max. L\195\164nge"
L['Limits the maximum length of the zone'] = "Limitiert die Anzeigel\195\164nge der Zone" L['Limits the maximum length of the zone'] = "Limitiert die Anzeigel\195\164nge der Zone"
L['Mapcoords Screen'] = "Kartenkoordinaten Vollbild" L['Mapcoords Screen'] = "Kartenkoordinaten Vollbild"
@ -34,10 +34,11 @@ if L then
L['This hides the coords-display in your broker display'] = "Zeigt die Koordinaten im Display-Broker nicht an" L['This hides the coords-display in your broker display'] = "Zeigt die Koordinaten im Display-Broker nicht an"
L['Colorized Zone'] = "Farbige Zone" L['Colorized Zone'] = "Farbige Zone"
L['Show PvP informations about current area'] = "Zeigt PvP Informationen zur Zone farblich an" L['Show PvP informations about current area'] = "Zeigt PvP Informationen zur Zone farblich an"
L['Set keybind'] = "Setze Tastaturbelegung"
end end
-- ö \195\182 ß \195\159 -- <EFBFBD> \195\182 <20> \195\159
-- ü \195\188 ä \195\164 -- <EFBFBD> \195\188 <20> \195\164
-- Ä \195\132 -- <EFBFBD> \195\132
-- ö \195\182 -- <EFBFBD> \195\182
-- Ü \195\156 -- <EFBFBD> \195\156

View File

@ -34,4 +34,5 @@ if L then
L['This hides the coords-display in your broker display'] = true L['This hides the coords-display in your broker display'] = true
L['Colorized Zone'] = true L['Colorized Zone'] = true
L['Show PvP informations about current area'] = true L['Show PvP informations about current area'] = true
L['Set keybind'] = true
end end

View File

@ -2,7 +2,10 @@ local addonName, addon = ...
local childName = addon['childName'] local childName = addon['childName']
local child = addon[childName] local child = addon[childName]
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true) local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
function child:PrefChanged() function child:PrefChanged(info, value, oldvalue)
if(info[#info] == 'toggleMap' and value ~= oldvalue) then
SetBinding(value, "CLICK zzCoords_MinimapToggleFrame:LeftButton")
end
child:ZoneEvent() child:ZoneEvent()
end end
local init = { local init = {
@ -20,6 +23,7 @@ local init = {
config:AddConfigEntry(main,'windowXY',"header",L['Mapcoords Window'],nil,6) config:AddConfigEntry(main,'windowXY',"header",L['Mapcoords Window'],nil,6)
config:AddConfigEntry(main,"windowX","range",L['Window X'],L['Adjusts the X-Offset on windowed map'],7,-512,512,1) config:AddConfigEntry(main,"windowX","range",L['Window X'],L['Adjusts the X-Offset on windowed map'],7,-512,512,1)
config:AddConfigEntry(main,"windowY","range",L['Window Y'],L['Adjusts the Y-Offset on windowed map'],8,-512,512,1) config:AddConfigEntry(main,"windowY","range",L['Window Y'],L['Adjusts the Y-Offset on windowed map'],8,-512,512,1)
config:AddConfigEntry(main,"toggleMap","keybinding",L['Toggle Minimap'],L['Set keybind'],5)
end end
} }
addon.RegisterCallback(init, format("Init%s", childName), 'Setup') addon.RegisterCallback(init, format("Init%s", childName), 'Setup')