diff --git a/CHANGELOG.md b/CHANGELOG.md index 61051cb..231244c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +## [1.6.1] - 2026-09-18 + +### Added + +- WoW: Forever beta support. The TOC now declares Interface 16001 alongside Retail 120100. + +### Fixed + +- The Edit Mode selection box now matches the square map exactly, so the map can be placed flush in a screen corner. Blizzard's minimap cluster is a resize-layout frame that re-sized itself to its hidden native children on every layout pass; ClassyMap now pins the cluster to the map's rendered footprint, follows the Edit Mode "Size" setting, and clamps the cluster to the screen without the old 60px overhang. + ## [1.6.0] - 2026-09-06 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 617ec00..509c52a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ This addon prioritizes a minimal footprint: ### Current Client Compatibility -The declared client target is Interface 120100 in [ClassyMap.toc](ClassyMap.toc). Record the actual client version/build used for live testing. When adding features: +The declared client targets are Interface 120100 (Retail) and 16001 (WoW: Forever beta) in [ClassyMap.toc](ClassyMap.toc). Forever runs the Retail UI and API, but `GetBuildInfo()` reports 16001, so never gate Retail code paths on a minimum build number. Record the actual client version/build used for live testing. When adding features: - Ensure modifications are resilient to UI updates - Follow the `OwnSet` ownership and conditional-restoration contract; preserve combat deferral and stale-callback cancellation diff --git a/ClassyMap.lua b/ClassyMap.lua index d846bd5..22d648b 100644 --- a/ClassyMap.lua +++ b/ClassyMap.lua @@ -36,6 +36,7 @@ local getters = { SetParent = "GetParent", SetWidth = "GetWidth", SetHeight = "GetHeight", + SetFixedSize = "GetFixedSize", SetFrameStrata = "GetFrameStrata", SetScale = "GetScale", SetAlpha = "GetAlpha", @@ -124,6 +125,7 @@ end local restoreOrder = { "SetParent", "SetScale", + "SetFixedSize", "SetWidth", "SetHeight", "points", @@ -487,16 +489,48 @@ function ClassyMap:SatStyles(f) self:OwnSet(f, "Show") end +-- The map's rendered size expressed in MinimapCluster coordinates. Edit Mode's +-- "Size" setting scales MinimapContainer, which sits between the two, so the +-- map's own GetWidth() no longer describes the space it occupies in the cluster. +function ClassyMap:GetMinimapFootprint() + local scale = 1 + local frame = Minimap + while frame and frame ~= MinimapCluster do + scale = scale * (frame.GetScale and frame:GetScale() or 1) + frame = frame.GetParent and frame:GetParent() + end + if not frame then + -- Another addon moved the map out of the cluster; compare effective scales. + scale = 1 + if Minimap.GetEffectiveScale and MinimapCluster.GetEffectiveScale then + local clusterScale = MinimapCluster:GetEffectiveScale() + if clusterScale and clusterScale > 0 then + scale = Minimap:GetEffectiveScale() / clusterScale + end + end + end + return Minimap:GetWidth() * scale, Minimap:GetHeight() * scale +end + local function ApplyLayout(self) local db = self.db.profile local MARGIN = 4 local STACK_GAP = 2 local ICON_SIZE = 24 -- Size for standardized placement if needed - -- Cluster & Map - if MinimapCluster then - self:OwnSet(MinimapCluster, "SetWidth", Minimap:GetWidth()) - self:OwnSet(MinimapCluster, "SetHeight", Minimap:GetHeight()) + -- Cluster & Map. MinimapCluster is a Blizzard ResizeLayoutFrame: its Layout() + -- pass (Edit Mode, OnShow) resizes it to the bounding box of the native + -- children, which is larger than the square map and leaves the Edit Mode + -- selection box loose around it. A fixed size makes Layout() reproduce the + -- map's footprint instead, so the selection box and screen clamping match + -- the map exactly. + if MinimapCluster and Minimap then + local width, height = self:GetMinimapFootprint() + if MinimapCluster.SetFixedSize then + self:OwnSet(MinimapCluster, "SetFixedSize", width, height) + end + self:OwnSet(MinimapCluster, "SetWidth", width) + self:OwnSet(MinimapCluster, "SetHeight", height) end if Minimap then self:OwnSet(Minimap, "ClearAllPoints") @@ -680,7 +714,8 @@ function ClassyMap:ApplyMinimapChanges() end if MinimapCluster then self:OwnSet(MinimapCluster, "SetClampedToScreen", true) - self:OwnSet(MinimapCluster, "SetClampRectInsets", 0, -60, 0, -60) + -- The cluster now matches the map, so it can sit flush against the screen edge. + self:OwnSet(MinimapCluster, "SetClampRectInsets", 0, 0, 0, 0) end self:OwnSet(Minimap, "SetClampedToScreen", false) end) @@ -696,6 +731,25 @@ function ClassyMap:ApplyMinimapChanges() hooksecurefunc(MinimapCluster, "SetHeight", function() self:RequestLayout() end) + if MinimapCluster.SetEditModeScale then + -- Edit Mode "Size" scales MinimapContainer; the fixed cluster size must follow. + hooksecurefunc(MinimapCluster, "SetEditModeScale", function() + self:RequestLayout() + end) + end + if MinimapCluster.Layout then + -- Safety net: a native layout pass that lands on a different size (stale + -- fixed size, or another addon cleared it) gets one corrective pass. + hooksecurefunc(MinimapCluster, "Layout", function(cluster) + if not self.runtimeEnabled or self.resizing then + return + end + local width, height = self:GetMinimapFootprint() + if cluster:GetWidth() ~= width or cluster:GetHeight() ~= height then + self:RequestLayout() + end + end) + end self.hookedLayout = true end end diff --git a/ClassyMap.toc b/ClassyMap.toc index 590caee..781a3fe 100644 --- a/ClassyMap.toc +++ b/ClassyMap.toc @@ -1,8 +1,8 @@ -## Interface: 120100 +## Interface: 120100, 16001 ## Title: ClassyMap ## Notes: A minimalist square minimap with a customizable border and clutter controls. ## Author: Jason Falk -## Version: 1.6.0 +## Version: 1.6.1 ## SavedVariables: ClassyMapDB ## IconTexture: Interface\Icons\INV_Misc_Map02 ## X-License: GPL-3.0 diff --git a/README.md b/README.md index d1e5795..3577c7a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A minimalist square minimap addon for World of Warcraft. Transforms the default circular minimap into a clean, modern square shape. -![Interface](https://img.shields.io/badge/Interface-120100-green) +![Interface](https://img.shields.io/badge/Interface-120100%20%7C%2016001-green) [![GitHub](https://img.shields.io/badge/GitHub-Falkicon%2FClassyMap-181717?logo=github)](https://github.com/Falkicon/ClassyMap) [![Sponsor](https://img.shields.io/badge/Sponsor-pink?logo=githubsponsors)](https://github.com/sponsors/Falkicon) @@ -65,7 +65,8 @@ Open settings via `/cm`, the ClassyMap entry in the addon compartment, or the in ## Requirements -- World of Warcraft Retail. The declared client target is Interface 120100 in [ClassyMap.toc](ClassyMap.toc). +- World of Warcraft Retail or the WoW: Forever beta. The declared client targets are Interface 120100 (Retail) and 16001 (Forever) in [ClassyMap.toc](ClassyMap.toc). +- On Forever, the client currently does not read saved variables back at launch, so ClassyMap settings reset to defaults each session. - Required libraries are bundled; Mechanic is optional developer tooling. ## Localization diff --git a/docs/runtime-design.md b/docs/runtime-design.md index a6527af..95ac664 100644 --- a/docs/runtime-design.md +++ b/docs/runtime-design.md @@ -22,6 +22,8 @@ Disable invalidates scheduled callbacks, clears pending requests and combat acti Restoration determines eligibility before changing anything, then restores properties in a defined order: parents and geometry before styling and visibility. This avoids treating a restoration's own side effects as a new external change. Combat-delayed restoration uses a private frame because AceEvent removes the addon's event registrations after `OnDisable` returns. +`MinimapCluster` is a Blizzard `ResizeLayoutFrame`. Its `Layout()` pass (Edit Mode, show) sizes it to the bounding box of its native children rather than the square map. ClassyMap owns the cluster's fixed layout size (`SetFixedSize`) alongside its width/height, computed from the map's size and the scale of every frame between the map and the cluster (Edit Mode's "Size" setting scales `MinimapContainer`). Hooks on `SetEditModeScale` and `Layout` request a layout pass only when the cluster lands on a different size, so the Edit Mode selection box and screen clamping match the map. + Known native zone-color and expansion-button visibility updates have explicit policies that keep ClassyMap's enabled customization working. Ownership is based on observed values, not the identity of the addon making a call. It cannot distinguish another addon invoking the same native update path, or a change to an identical value. This is cooperative behavior, not a guarantee against all minimap-addon conflicts. The original minimap mask/blob scalar state cannot be queried reliably through matching getters. Disabling therefore stops scheduling and restores eligible geometry/styles, but retains square mask behavior and matching square shape reporting until reload. Hybrid mask behavior follows the same policy. No settings control advertises complete runtime disable; remove/disable the addon and reload for full removal. Another addon replacing the shape function is respected by subsequent setup work. diff --git a/tests/runtime_regressions.lua b/tests/runtime_regressions.lua index 278f477..ecf838a 100644 --- a/tests/runtime_regressions.lua +++ b/tests/runtime_regressions.lua @@ -124,6 +124,31 @@ Assert.equal(calls.ApplyFontStyles, 1, "startup did not apply fonts once") Assert.equal(calls.FixLayout, 1, "startup did not apply layout once") Assert.equal(#env.errors, 0, "startup reported an error") +-- The cluster is a Blizzard ResizeLayoutFrame. Its native Layout() pass (Edit +-- Mode, OnShow) must keep reproducing the map's rendered footprint, including +-- the Edit Mode size scale applied to MinimapContainer, without extra work. +resetCalls() +Assert.equal(MinimapCluster:GetWidth(), Minimap:GetWidth(), "cluster width does not match the map") +Assert.equal(MinimapCluster:GetHeight(), Minimap:GetHeight(), "cluster height does not match the map") +MinimapCluster:Layout() +Assert.equal(MinimapCluster:GetWidth(), Minimap:GetWidth(), "native layout pass resized the cluster away from the map") +Assert.equal(MinimapCluster:GetHeight(), Minimap:GetHeight(), "native layout pass changed the cluster height") +Assert.equal(#env.timers, 0, "a matching native layout pass scheduled work") +MinimapCluster:SetEditModeScale(0.5) +Assert.equal(#env.timers, 1, "Edit Mode scale change did not schedule one layout pass") +env:FlushTimers() +Assert.equal(calls.FixLayout, 1, "Edit Mode scale change did not run one layout pass") +Assert.equal(MinimapCluster:GetWidth(), Minimap:GetWidth() * 0.5, "cluster did not follow the scaled map footprint") +Assert.equal(MinimapCluster:GetHeight(), Minimap:GetHeight() * 0.5, "cluster height ignored the map scale") +Assert.point(Minimap, 1, { "CENTER", MinimapCluster, "CENTER", 0, 0 }, "scaled map is not centered in the cluster") +MinimapCluster:Layout() +Assert.equal(MinimapCluster:GetWidth(), Minimap:GetWidth() * 0.5, "layout pass after a scale change lost the footprint") +Assert.equal(#env.timers, 0, "a matching scaled layout pass scheduled work") +MinimapCluster:SetEditModeScale(1) +env:FlushTimers() +Assert.equal(MinimapCluster:GetWidth(), Minimap:GetWidth(), "cluster did not return to the unscaled footprint") +Assert.equal(#env.errors, 0, "cluster layout tracking reported an error") + -- Both Blizzard dimension hooks coalesce, and a layout error cannot strand the guard. resetCalls() MinimapCluster:SetWidth(200) @@ -374,6 +399,9 @@ Assert.equal(GameTimeFrame:GetParent(), externalParent, "disable overwrote an ex Assert.point(GameTimeFrame, 1, { "BOTTOM", externalParent, "BOTTOM", 9, 10 }, "disable overwrote external anchors") Assert.equal(GameTimeFrame:IsShown(), false, "disable overwrote external visibility") Assert.point(Minimap, 1, { "CENTER", MinimapCluster, "CENTER", 3, 4 }, "owned minimap anchor was not restored") +Assert.equal((MinimapCluster:GetFixedSize()), nil, "disable did not clear the cluster's fixed layout size") +MinimapCluster:Layout() +Assert.equal(MinimapCluster:GetWidth(), 256, "disabled addon still pinned the native cluster layout") Assert.equal(MinimapCompassTexture:IsShown(), true, "owned compass visibility was not restored") Assert.equal(MinimapCompassTexture:GetAlpha(), 1, "owned compass alpha was not restored") diff --git a/tests/support/wow_mock.lua b/tests/support/wow_mock.lua index 1dac4de..c1c9af8 100644 --- a/tests/support/wow_mock.lua +++ b/tests/support/wow_mock.lua @@ -573,9 +573,40 @@ function Mock:Install(options) protected = true, points = { pack("TOPRIGHT", nativeParent, "TOPRIGHT", -20, -20) }, }) - _G.Minimap = self:NewFrame("Minimap", { + -- Blizzard's cluster is a ResizeLayoutFrame: Layout() sizes it to its native + -- children unless a fixed size is set. Edit Mode's size setting scales the + -- container between the cluster and the map. + MinimapCluster.nativeLayoutSize = pack(256, 256) + function MinimapCluster:SetFixedSize(width, height) + mutate(self, "SetFixedSize", width, height) + self.fixedSize = pack(width, height) + end + function MinimapCluster:GetFixedSize() + local fixed = self.fixedSize or pack(nil, nil) + return unpackValues(fixed, 1, fixed.n) + end + function MinimapCluster:Layout() + record(self, "Layout") + local fixedWidth, fixedHeight = self:GetFixedSize() + if fixedWidth and fixedHeight then + self:SetSize(fixedWidth, fixedHeight) + else + self:SetSize(unpackValues(self.nativeLayoutSize, 1, 2)) + end + end + function MinimapCluster:SetEditModeScale(scale) + record(self, "SetEditModeScale", scale) + self.MinimapContainer:SetScale(scale) + self:Layout() + end + MinimapCluster.MinimapContainer = self:NewFrame("MinimapContainer", { parent = MinimapCluster, protected = true, + points = { pack("TOP", MinimapCluster, "TOP", 10, -30) }, + }) + _G.Minimap = self:NewFrame("Minimap", { + parent = MinimapCluster.MinimapContainer, + protected = true, points = { pack("CENTER", MinimapCluster, "CENTER", 3, 4) }, }) Minimap.ZoomIn = self:NewFrame("MinimapZoomIn", { parent = Minimap, protected = true })