mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
* feat(frame): add SetClampRectInsets / GetClampRectInsets Later clients let a frame that is clamped to the screen keep a different rect on screen than its own: SetClampRectInsets(left, right, top, bottom) grows or shrinks the rect the clamp uses. Zygor Guides Viewer 2.0 sets them on its frames while building them (a negative top inset lets a frame's top go off screen), and 3.3.5's own FrameXML uses them too. The engine clamps a frame to the screen inside its rect calculation (0x00767A20): it resolves the edges and, for a clamped frame, slides the rect onto the screen. Hook that calculation: for a frame with insets, take the unclamped rect, grow it by the insets (converted from the frame's units to layout units with the inverse of Script GetLeft's scaling), slide that onto the screen with the engine's own steps and order, and move the frame's rect by the same amount. Frames without insets go through the engine's clamp as before. SetClampRectInsets re-lays the frame out, as SetClampedToScreen does, and (0, 0, 0, 0) clears the insets. Sign convention from 3.3.5's own calls: WorldMapFrame (0, 0, 0, -60) "don't overlap the xp/rep bars", chat frames (-35, 35, 26, -50). Verified in-game (1.12.1 client via VanillaFixes): a clamped 100x100 frame placed 10 above the bottom of the screen stays at 10, moves to 60 with (0, 0, 0, -60) and back to 10 once cleared; a frame placed 20 over the top is clamped to the edge and, with a top inset of -25, keeps its 20 over. GetClampRectInsets returns the insets set. * refactor(frame): address review of SetClampRectInsets Use the existing OFF_REGION_ANCHOR and UI coordinate globals instead of new duplicate offsets, and move the pixel/anchor-unit conversion into one shared Game::PixelToInternal / InternalToPixel pair (replacing the copies in LinePool, Transform and Metrics). Restore only the clamp bit around the unclamped rect calculation so other layout flag bits survive. Add doc descriptors for both methods and drop version/implementation notes from the user docs. --------- Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>