diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b3147..4556348 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,7 @@ All notable changes to OctoLatency are documented in this file. ## [Unreleased] ### Added -- `/octolat copyerrors` and a minimap button, both opening a copy-errors window: a multi-line `EditBox` pre-filled with the error log and auto-highlighted, so the text can be selected and copied with Ctrl+C (vanilla WoW's chat frame doesn't support text selection). -- Minimap button also right-click toggles the latency frame, and can be dragged to reposition around the minimap (position saved to `OctoLatencyDB.minimapAngle`). +- `/octolat copyerrors`, opening a copy-errors window: a multi-line `EditBox` pre-filled with the error log and auto-highlighted, so the text can be selected and copied with Ctrl+C (vanilla WoW's chat frame doesn't support text selection). - Colored addon title in the character-select AddOns list: `OctoLatency` now renders as a per-letter gradient from dark to light green (`## Title:` in `OctoLatency.toc`). ### Fixed diff --git a/OctoLatency.lua b/OctoLatency.lua index 8beed48..532ce92 100644 --- a/OctoLatency.lua +++ b/OctoLatency.lua @@ -188,84 +188,7 @@ function OctoLatency_ShowCopyErrors() copyEditBox:HighlightText() end --------------------------------------------------------------------------------- --- Minimap button: left-click opens the copy-errors window, right-click toggles --- the latency frame, drag to reposition around the minimap. --------------------------------------------------------------------------------- -local function OctoLatency_UpdateMinimapButtonPosition(button) - local db = OctoLatency_EnsureDB() - local angle = db.minimapAngle or 220 - local rad = math.rad(angle) - local radius = 80 - button:ClearAllPoints() - button:SetPoint("CENTER", Minimap, "CENTER", radius * math.cos(rad), radius * math.sin(rad)) -end - -local function OctoLatency_CreateMinimapButton() - local button = CreateFrame("Button", "OctoLatencyMinimapButton", Minimap) - button:SetWidth(31) - button:SetHeight(31) - button:SetFrameStrata("MEDIUM") - button:SetFrameLevel(8) - button:RegisterForClicks("LeftButtonUp", "RightButtonUp") - button:RegisterForDrag("LeftButton") - - local icon = button:CreateTexture(nil, "BACKGROUND") - icon:SetWidth(20) - icon:SetHeight(20) - icon:SetPoint("CENTER", 0, 0) - icon:SetTexture("Interface\\Icons\\INV_Misc_PocketWatch_01") - - local overlay = button:CreateTexture(nil, "OVERLAY") - overlay:SetWidth(53) - overlay:SetHeight(53) - overlay:SetPoint("TOPLEFT", 0, 0) - overlay:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder") - - button:SetScript("OnClick", function() - OctoLatency_SafeCall("MinimapButtonClick", function() - if (arg1 == "RightButton") then - if (OctoLatencyFrame:IsShown()) then - OctoLatencyFrame:Hide() - else - OctoLatencyFrame:Show() - end - else - OctoLatency_ShowCopyErrors() - end - end) - end) - - button:SetScript("OnEnter", function() - GameTooltip:SetOwner(this, "ANCHOR_LEFT") - GameTooltip:AddLine("OctoLatency", 0, 1, 1) - GameTooltip:AddLine("Left-click: copy error log", 1, 1, 1) - GameTooltip:AddLine("Right-click: toggle latency frame", 1, 1, 1) - GameTooltip:AddLine("Drag: move this button", 0.7, 0.7, 0.7) - GameTooltip:Show() - end) - button:SetScript("OnLeave", function() GameTooltip:Hide() end) - - button:SetScript("OnDragStart", function() - this:SetScript("OnUpdate", function() - local mx, my = GetCursorPosition() - local scale = Minimap:GetEffectiveScale() - mx, my = mx / scale, my / scale - local cx, cy = Minimap:GetCenter() - local db = OctoLatency_EnsureDB() - db.minimapAngle = math.deg(math.atan2(my - cy, mx - cx)) - OctoLatency_UpdateMinimapButtonPosition(this) - end) - end) - button:SetScript("OnDragStop", function() - this:SetScript("OnUpdate", nil) - end) - - OctoLatency_UpdateMinimapButtonPosition(button) - return button -end - --- Load saved position and create the minimap button on PLAYER_LOGIN +-- Load saved position if available on PLAYER_LOGIN local loadFrame = CreateFrame("Frame") loadFrame:RegisterEvent("PLAYER_LOGIN") loadFrame:SetScript("OnEvent", function() @@ -274,7 +197,6 @@ loadFrame:SetScript("OnEvent", function() OctoLatencyFrame:ClearAllPoints() OctoLatencyFrame:SetPoint(OctoLatencyDB.point, UIParent, OctoLatencyDB.relativePoint, OctoLatencyDB.xOfs, OctoLatencyDB.yOfs) end - OctoLatency_CreateMinimapButton() end) end) diff --git a/README.md b/README.md index f59b8c1..2c7c4e1 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,5 @@ you to report: opens with the text already highlighted, so you can just press Ctrl+C. - `/octolat clearerrors` — clear the error log. -There's also a minimap button for the same purpose without typing a command: - -- **Left-click** — open the copy-errors window. -- **Right-click** — toggle the latency frame on/off. -- **Drag** — reposition the button around the minimap. - The log is also saved to your `SavedVariables` file, so it survives logout/relog.