1#ifndef YAZE_APP_EDITOR_OVERWORLD_CANVAS_NAVIGATION_MANAGER_H
2#define YAZE_APP_EDITOR_OVERWORLD_CANVAS_NAVIGATION_MANAGER_H
10#include "absl/status/status.h"
23class OverworldEntityRenderer;
38 ImVec2
Consume(ImVec2 wheel,
float dt,
float step_px,
float snap_px);
84 std::array<gfx::Bitmap, zelda3::kExpandedMapCount>*
maps_bmp =
nullptr;
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
void ScrollBlocksetCanvasToCurrentTile()
Scroll the blockset (tile16 selector) to show the currently selected tile16.
void SuspendHoverFollowUntilMouseMoves()
ImVec2 pan_anchor_scroll_
std::optional< int > MapUnderCursor() const
static constexpr float kHoverBuildDelay
absl::Status CheckForCurrentMap()
Detect which map the mouse is over, trigger lazy loading, draw the selection outline,...
CanvasNavigationManager()=default
void CenterOnMap(int map_id)
Center the viewport on map_id (same world grid).
void UpdateBlocksetSelectorState()
Push current tile count and selection into the blockset widget.
void ProcessPreloadQueue()
Process one map from the preload queue (call once per frame).
std::optional< int > pending_center_map_
void SetScaleAboutAnchor(float new_scale, ImVec2 anchor)
std::optional< int > TrackMapAtCanvasPosition(ImVec2 scaled_position)
void CenterOnWorldTile(int world_x, int world_y)
CanvasNavigationCallbacks callbacks_
CanvasNavigationContext ctx_
bool canvas_window_hovered_
std::optional< ImVec2 > pending_scroll_
bool canvas_item_hovered_
void QueueAdjacentMapsForPreload(int center_map)
Queue the 4-connected neighbors of center_map for lazy build.
static constexpr float kPreloadStartDelay
std::vector< int > preload_queue_
void Initialize(const CanvasNavigationContext &context, const CanvasNavigationCallbacks &callbacks)
Initialize with shared state and callbacks.
void HandleMapInteraction()
Click selection (see IsMapSelectClick) and double-click to open properties. The paint-tool right-clic...
void ZoomToFit()
Scale so the whole current world fits the viewport.
void ZoomOut()
Decrease canvas zoom by one step, keeping the view center fixed.
void CenterOverworldView()
Center the viewport on the current map.
std::optional< ImVec2 > hover_follow_suspended_at_
std::optional< int > left_press_map_
ImVec2 ContentSize() const
StickyWheelPan wheel_pan_
void ZoomBySteps(int steps, ImVec2 anchor)
bool SelectMapUnderCursor()
Make the map under the cursor the current map, ignoring the pin (the pin, if on, then holds this map)...
void BeginCanvasViewport()
void EndCanvasViewport(bool canvas_item_hovered)
ImVec2 ClampScroll(ImVec2 scroll) const
void ZoomIn()
Increase canvas zoom by one step, keeping the view center fixed.
void ResetOverworldView()
Reset scroll to top-left and scale to 1.0.
Modern, robust canvas for drawing and manipulating graphics.
Editors are the view controllers for the application.
ImVec2 ScrollForZoomAtAnchor(ImVec2 scroll, ImVec2 anchor, float old_scale, float new_scale)
bool IsMapSelectClick(const MapClickInput &input)
Callbacks for operations that remain in the OverworldEditor.
std::function< void()> refresh_overworld_map
std::function< absl::Status()> refresh_tile16_blockset
std::function< void(int, bool)> select_map_for_editing
std::function< bool()> is_entity_hovered
Returns true if an entity is currently hovered (for pan suppression).
std::function< bool()> pick_tile16_from_hovered_canvas
std::function< void(int)> ensure_map_texture
std::function< void()> open_map_properties
Opens (and focuses) the Map Properties window. Double-click target.
Shared state pointers that the navigation manager reads/writes.
std::array< gfx::Bitmap, zelda3::kExpandedMapCount > * maps_bmp
std::unique_ptr< gui::TileSelectorWidget > * blockset_selector
gui::Canvas * ow_map_canvas
zelda3::Overworld * overworld
bool * is_dragging_entity
gfx::Tilemap * tile16_blockset
EditingMode * current_mode
ImVec2 Consume(ImVec2 wheel, float dt, float step_px, float snap_px)
Tilemap structure for SNES tile-based graphics management.