Thread Tools Display Modes
01-14-17, 08:24 AM   #1
Eroox
A Murloc Raider
Join Date: Aug 2015
Posts: 9
Make a frame click-through [help me]

Hello!

"Khio" has made an addon that moves the minimap to an other location basically. However I need to be able to click-through it at the location I have it now, basically to the right of my character. How do I make the frame click-through via lua. This is the full main.lua file and I believe it is in here that I need to make it happen.

Lua Code:
  1. local KhioHud = LibStub("AceAddon-3.0"):NewAddon("KhioHud", "AceEvent-3.0")
  2. local L = LibStub("AceLocale-3.0"):GetLocale("KhioHud")
  3.  
  4. KhioHud.minimapOverlay = _G["KhioHud"].minimapOverlay
  5. KhioHud.toggleButton = _G["KhioHud"].toggleButton
  6. local MinimapCluster = _G["MinimapCluster"]
  7. local Minimap = _G["Minimap"]
  8.  
  9. function KhioHud:OnInitialize()
  10.     self:InitializeSettings()
  11.     self:RegisterEvent("PLAYER_ENTERING_WORLD")
  12. end
  13.  
  14. function KhioHud:OnEnable()
  15.     self:AddToBlizOptions()
  16.  
  17.     if (not KhioHud.minimapOverlay:IsVisible()) then
  18.         KhioHud.restorePosition = KhioHud:GetMinimapPosition()
  19.     end
  20.  
  21.     --ElvUI dirty fix
  22.     if (IsAddOnLoaded("ElvUI")) then
  23.         MinimapCluster:ClearAllPoints()
  24.         Minimap:ClearAllPoints()
  25.         Minimap:SetPoint("TOPLEFT", MinimapCluster)
  26.     end
  27.     --ElvUI dirty fix
  28.  
  29.     local button = KhioHud.toggleButton
  30.     button:RegisterForClicks("LeftButtonDown", "RightButtonDown")
  31.     button:SetScript("OnEnter", function(self, motion)
  32.         GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
  33.         GameTooltip:AddLine(L["Left Click: Toggle Khio Hud"])
  34.         GameTooltip:AddLine(L["Right Click: Show options"])
  35.         GameTooltip:AddLine(L["SHIFT + Drag: Move minimap"])
  36.         GameTooltip:Show()
  37.     end)
  38.     button:SetScript("OnLeave", function(self, motion)
  39.         GameTooltip:Hide()
  40.     end)
  41.     button:SetScript("OnClick", function(self, button, down)
  42.         if (button == "LeftButton" and down and not IsShiftKeyDown()) then
  43.             KhioHud:Toggle(not KhioHud.minimapOverlay:IsVisible())
  44.         elseif (button == "RightButton" and down) then
  45.             InterfaceOptionsFrame_OpenToCategory("Khio Hud")
  46.             InterfaceOptionsFrame_OpenToCategory("Khio Hud")
  47.         end
  48.     end)
  49.     button:SetScript("OnMouseDown", function(self, button)
  50.         if (button == "LeftButton" and IsShiftKeyDown() and not self.isMoving) then
  51.             MinimapCluster:SetMovable(true)
  52.             MinimapCluster:StartMoving()
  53.             self.isMoving = true
  54.         end
  55.     end)
  56.     button:SetScript("OnMouseUp", function(self, button)
  57.         if (button == "LeftButton" and self.isMoving) then
  58.             MinimapCluster:StopMovingOrSizing()
  59.             MinimapCluster:SetMovable(false)
  60.             self.isMoving = false
  61.  
  62.             KhioHudDB.minimap = KhioHud:GetMinimapPosition()
  63.             KhioHud:Toggle(true)
  64.         end
  65.     end)
  66. end
  67.  
  68. function KhioHud:OnDisable()
  69. end
  70.  
  71. function KhioHud:PLAYER_ENTERING_WORLD()
  72.     local inInstance, instanceType = IsInInstance()
  73.  
  74.     if (inInstance and KhioHudDB.autoToggle.inside) then
  75.         KhioHud:Toggle(true)
  76.     elseif(not inInstance and KhioHudDB.autoToggle.outside) then
  77.         KhioHud:Toggle(false)
  78.     end
  79. end
  80.  
  81. function KhioHud:Toggle(visible)
  82.     if (visible) then
  83.         Minimap:SetZoom(5)
  84.         Minimap:EnableMouse(false)
  85.         Minimap:EnableMouseWheel(false)
  86.         MinimapCluster:SetAlpha(0)
  87.         SetCVar("rotateMinimap", true)
  88.         KhioHud:SetMinimapPosition(KhioHudDB.minimap.x, KhioHudDB.minimap.y)
  89.         KhioHud.minimapOverlay:Show()
  90.     else
  91.         Minimap:SetZoom(1)
  92.         Minimap:EnableMouse(true)
  93.         Minimap:EnableMouseWheel(true)
  94.         MinimapCluster:SetAlpha(1)
  95.         SetCVar("rotateMinimap", false)
  96.  
  97.         KhioHud:SetMinimapPosition(KhioHud.restorePosition.x, KhioHud.restorePosition.y)
  98.         KhioHud.minimapOverlay:Hide()
  99.     end
  100. end
  101.  
  102. function KhioHud:GetMinimapPosition()
  103.     local s = MinimapCluster:GetEffectiveScale()
  104.     return { x = MinimapCluster:GetLeft() * s, y = MinimapCluster:GetTop() * s }
  105. end
  106.  
  107. function KhioHud:SetMinimapPosition(x, y)
  108.     if (x ~= nil and y ~= nil) then
  109.         local s = MinimapCluster:GetEffectiveScale()
  110.         MinimapCluster:ClearAllPoints()
  111.         MinimapCluster:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x / s, y / s)
  112.     end
  113. end
  Reply With Quote
01-14-17, 11:09 AM   #2
d87
A Chromatic Dragonspawn
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 163
<Frame>:EnableMouse(false)
  Reply With Quote
01-14-17, 11:16 AM   #3
Eroox
A Murloc Raider
Join Date: Aug 2015
Posts: 9
Originally Posted by d87 View Post
<Frame>:EnableMouse(false)
Are you sure? Since that line is already included here:

Lua Code:
  1. function KhioHud:Toggle(visible)
  2.     if (visible) then
  3.         Minimap:SetZoom(5)
  4.         Minimap:EnableMouse(false) <------------------------------------
  5.         Minimap:EnableMouseWheel(false)
  6.         MinimapCluster:SetAlpha(0)
  7.         SetCVar("rotateMinimap", true)
  8.         KhioHud:SetMinimapPosition(KhioHudDB.minimap.x, KhioHudDB.minimap.y)
  9.         KhioHud.minimapOverlay:Show()

It is true that nothing happens when you click on the frame. However your not clicking through the frame so I cant press on that area on my screen and rotate my camera angel.
  Reply With Quote
01-14-17, 11:56 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Maybe if you unregister the minimaps "MINIMAP_PING" event.

Just a wag. Unlikely to work as the minimap widget is still trapping the click in order to generate the event.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-14-17 at 12:01 PM.
  Reply With Quote
01-14-17, 12:25 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
If you use /fstack and over over your minimap, do you see the MinimapCluster frame or anything else below your mouse?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-14-17, 03:45 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Line 92 turns the mouse clicks back on, set that to false.

PS: If you want the mouse wheel to pass through, set line 93 to false too.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Make a frame click-through [help me]


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off