yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
ui_constants.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_UI_CONSTANTS_H
2#define YAZE_APP_EDITOR_DUNGEON_UI_CONSTANTS_H
3
4// Shared layout constants for the dungeon editor UI. Mirrors
5// src/app/editor/overworld/ui_constants.h: each editor family keeps its layout
6// tuning in one header so panels, widgets, and tests reference a single source
7// of truth instead of redefining literals in .cc files.
8//
9// Scope: only constants that are load-bearing for layout math or that are
10// meaningful to external callers (tests, sibling panels). Purely file-local
11// IDs (ImGui child/popup strings) should stay as anonymous-namespace locals
12// in their owning translation unit.
13
15
16// Logical pixel footprint of a single dungeon room as rendered on the canvas.
17// 64 tiles * 8 px. Used by the connected-room graph and overview.
18inline constexpr float kDungeonRoomPixelSize = 512.0f;
19
20// Gap (in logical pixels) between rooms in the connected-room graph layout.
21inline constexpr float kConnectedRoomGap = 48.0f;
22
23// Connected-canvas zoom bounds + default.
24inline constexpr float kConnectedCanvasDefaultScale = 0.18f;
25inline constexpr float kConnectedCanvasMinScale = 0.12f;
26inline constexpr float kConnectedCanvasMaxScale = 0.60f;
27
28// Overview / current-room preview side-panel geometry.
29inline constexpr float kConnectedSidePanelGap = 12.0f;
30inline constexpr float kConnectedSidePanelApproxMinWidth = 196.0f;
31// Hysteresis band. Once the side panel is visible it stays visible down to
32// `min - kConnectedSidePanelHideHysteresis` pixels of viewport width. Below
33// that the panel collapses. Prevents a sudden ~220 px horizontal snap when
34// toggling the panel near the visibility threshold.
35inline constexpr float kConnectedSidePanelHideHysteresis = 40.0f;
36inline constexpr float kConnectedControlsApproxHeight = 62.0f;
37inline constexpr float kConnectedOverviewApproxHeight = 168.0f;
38inline constexpr float kConnectedPreviewApproxHeight = 212.0f;
39
40// Overview panel sizing.
41inline constexpr float kConnectedOverviewMaxWidth = 196.0f;
42inline constexpr float kConnectedOverviewMaxHeight = 152.0f;
43
44// Current-room preview HUD sizing.
45inline constexpr float kConnectedCurrentRoomPreviewWidth = 160.0f;
46inline constexpr float kConnectedCurrentRoomPreviewPadding = 12.0f;
47
48// Room-label chrome on the connected matrix.
49inline constexpr float kConnectedRoomLabelPadding = 10.0f;
50inline constexpr float kConnectedRoomLabelHeight = 28.0f;
51inline constexpr float kConnectedRoomHighlightThickness = 3.0f;
52inline constexpr float kConnectedRoomOutlineThickness = 1.5f;
53
54// Returns true when the side panel should remain visible, with hysteresis to
55// avoid layout bounce. `viewport_width` is the unreserved width of the
56// connected canvas viewport (i.e. the body child's width).
57constexpr bool ShouldShowConnectedSidePanel(float viewport_width,
58 bool currently_visible) {
59 const float hide_threshold = currently_visible
63 return viewport_width >= hide_threshold;
64}
65
66} // namespace yaze::editor::dungeon_ui
67
68#endif // YAZE_APP_EDITOR_DUNGEON_UI_CONSTANTS_H
constexpr float kDungeonRoomPixelSize
constexpr float kConnectedPreviewApproxHeight
constexpr float kConnectedSidePanelGap
constexpr float kConnectedCanvasMinScale
constexpr float kConnectedCurrentRoomPreviewPadding
constexpr float kConnectedRoomLabelPadding
constexpr float kConnectedRoomHighlightThickness
constexpr float kConnectedCurrentRoomPreviewWidth
constexpr bool ShouldShowConnectedSidePanel(float viewport_width, bool currently_visible)
constexpr float kConnectedRoomOutlineThickness
constexpr float kConnectedRoomGap
constexpr float kConnectedRoomLabelHeight
constexpr float kConnectedCanvasDefaultScale
constexpr float kConnectedControlsApproxHeight
constexpr float kConnectedCanvasMaxScale
constexpr float kConnectedOverviewApproxHeight
constexpr float kConnectedOverviewMaxWidth
constexpr float kConnectedSidePanelApproxMinWidth
constexpr float kConnectedSidePanelHideHysteresis
constexpr float kConnectedOverviewMaxHeight