yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::CanvasNavigationManager Class Reference

#include <canvas_navigation_manager.h>

Collaboration diagram for yaze::editor::CanvasNavigationManager:

Public Member Functions

 CanvasNavigationManager ()=default
 
void Initialize (const CanvasNavigationContext &context, const CanvasNavigationCallbacks &callbacks)
 Initialize with shared state and callbacks.
 
absl::Status CheckForCurrentMap ()
 Detect which map the mouse is over, trigger lazy loading, draw the selection outline, and refresh textures if modified.
 
void HandleMapInteraction ()
 Handle tile-mode right-click (eyedropper) and middle-click (lock/properties toggle), plus double-click to open properties.
 
void HandleOverworldPan ()
 Pan the overworld canvas via middle-click or left-click drag (in MOUSE mode when not hovering an entity).
 
void HandleOverworldZoom ()
 No-op stub preserved for API compatibility.
 
void ZoomIn ()
 Increase canvas zoom by one step.
 
void ZoomOut ()
 Decrease canvas zoom by one step.
 
void ClampOverworldScroll ()
 No-op stub – ImGui handles scroll clamping automatically.
 
void ResetOverworldView ()
 Reset scroll to top-left and scale to 1.0.
 
void CenterOverworldView ()
 Center the viewport on the current map.
 
void CheckForMousePan ()
 Legacy wrapper – delegates to HandleOverworldPan().
 
void ScrollBlocksetCanvasToCurrentTile ()
 Scroll the blockset (tile16 selector) to show the currently selected tile16.
 
void UpdateBlocksetSelectorState ()
 Push current tile count and selection into the blockset widget.
 
void QueueAdjacentMapsForPreload (int center_map)
 Queue the 4-connected neighbors of center_map for lazy build.
 
void ProcessPreloadQueue ()
 Process one map from the preload queue (call once per frame).
 

Private Attributes

CanvasNavigationContext ctx_
 
CanvasNavigationCallbacks callbacks_
 
int last_hovered_map_ = -1
 
float hover_time_ = 0.0f
 
std::vector< int > preload_queue_
 

Static Private Attributes

static constexpr float kHoverBuildDelay = 0.15f
 
static constexpr float kPreloadStartDelay = 0.3f
 

Detailed Description

Definition at line 79 of file canvas_navigation_manager.h.

Constructor & Destructor Documentation

◆ CanvasNavigationManager()

yaze::editor::CanvasNavigationManager::CanvasNavigationManager ( )
default

Member Function Documentation

◆ Initialize()

void yaze::editor::CanvasNavigationManager::Initialize ( const CanvasNavigationContext & context,
const CanvasNavigationCallbacks & callbacks )

Initialize with shared state and callbacks.

Definition at line 47 of file canvas_navigation_manager.cc.

References callbacks_, and ctx_.

◆ CheckForCurrentMap()

absl::Status yaze::editor::CanvasNavigationManager::CheckForCurrentMap ( )

Detect which map the mouse is over, trigger lazy loading, draw the selection outline, and refresh textures if modified.

Definition at line 58 of file canvas_navigation_manager.cc.

References yaze::gfx::Tilemap::atlas, callbacks_, ctx_, yaze::editor::CanvasNavigationContext::current_map, yaze::editor::CanvasNavigationContext::current_map_lock, yaze::editor::CanvasNavigationContext::current_mode, yaze::editor::CanvasNavigationContext::current_parent, yaze::editor::CanvasNavigationContext::current_world, yaze::gui::Canvas::DrawOutline(), yaze::editor::CanvasNavigationCallbacks::ensure_map_texture, yaze::zelda3::Overworld::EnsureMapBuilt(), yaze::gfx::Arena::Get(), yaze::core::FeatureFlags::get(), yaze::zelda3::OverworldVersionHelper::GetVersion(), yaze::gui::Canvas::global_scale(), yaze::gui::Canvas::hover_mouse_pos(), hover_time_, yaze::gfx::Bitmap::is_active(), yaze::core::FeatureFlags::Flags::Overworld::kEnableSpecialWorldExpansion, kHoverBuildDelay, yaze::editor::kOverworldMapSize, kPreloadStartDelay, last_hovered_map_, yaze::editor::CanvasNavigationContext::maps_bmp, yaze::editor::MOUSE, yaze::editor::CanvasNavigationContext::overworld, yaze::core::FeatureFlags::Flags::overworld, yaze::zelda3::Overworld::overworld_map(), yaze::editor::CanvasNavigationContext::ow_map_canvas, preload_queue_, ProcessPreloadQueue(), QueueAdjacentMapsForPreload(), yaze::gfx::Arena::QueueTextureCommand(), yaze::editor::CanvasNavigationCallbacks::refresh_overworld_map, yaze::editor::CanvasNavigationCallbacks::refresh_tile16_blockset, RETURN_IF_ERROR, yaze::editor::CanvasNavigationContext::rom, yaze::zelda3::OverworldVersionHelper::SupportsAreaEnum(), yaze::editor::CanvasNavigationContext::tile16_blockset, and yaze::gfx::Arena::UPDATE.

◆ HandleMapInteraction()

◆ HandleOverworldPan()

void yaze::editor::CanvasNavigationManager::HandleOverworldPan ( )

Pan the overworld canvas via middle-click or left-click drag (in MOUSE mode when not hovering an entity).

Definition at line 317 of file canvas_navigation_manager.cc.

References callbacks_, ctx_, yaze::editor::CanvasNavigationContext::current_mode, yaze::editor::CanvasNavigationContext::is_dragging_entity, yaze::editor::CanvasNavigationCallbacks::is_entity_hovered, and yaze::editor::MOUSE.

Referenced by CheckForMousePan().

◆ HandleOverworldZoom()

void yaze::editor::CanvasNavigationManager::HandleOverworldZoom ( )

No-op stub preserved for API compatibility.

Definition at line 357 of file canvas_navigation_manager.cc.

◆ ZoomIn()

void yaze::editor::CanvasNavigationManager::ZoomIn ( )

◆ ZoomOut()

void yaze::editor::CanvasNavigationManager::ZoomOut ( )

◆ ClampOverworldScroll()

void yaze::editor::CanvasNavigationManager::ClampOverworldScroll ( )

No-op stub – ImGui handles scroll clamping automatically.

Definition at line 378 of file canvas_navigation_manager.cc.

◆ ResetOverworldView()

void yaze::editor::CanvasNavigationManager::ResetOverworldView ( )

Reset scroll to top-left and scale to 1.0.

Definition at line 383 of file canvas_navigation_manager.cc.

References ctx_, yaze::editor::CanvasNavigationContext::ow_map_canvas, and yaze::gui::Canvas::set_global_scale().

Here is the call graph for this function:

◆ CenterOverworldView()

void yaze::editor::CanvasNavigationManager::CenterOverworldView ( )

Center the viewport on the current map.

Definition at line 390 of file canvas_navigation_manager.cc.

References ctx_, yaze::editor::CanvasNavigationContext::current_map, yaze::gui::Canvas::global_scale(), yaze::editor::kOverworldMapSize, and yaze::editor::CanvasNavigationContext::ow_map_canvas.

Here is the call graph for this function:

◆ CheckForMousePan()

void yaze::editor::CanvasNavigationManager::CheckForMousePan ( )

Legacy wrapper – delegates to HandleOverworldPan().

Definition at line 419 of file canvas_navigation_manager.cc.

References HandleOverworldPan().

Here is the call graph for this function:

◆ ScrollBlocksetCanvasToCurrentTile()

void yaze::editor::CanvasNavigationManager::ScrollBlocksetCanvasToCurrentTile ( )

Scroll the blockset (tile16 selector) to show the currently selected tile16.

Definition at line 428 of file canvas_navigation_manager.cc.

References yaze::editor::CanvasNavigationContext::blockset_selector, ctx_, and yaze::editor::CanvasNavigationContext::current_tile16.

◆ UpdateBlocksetSelectorState()

void yaze::editor::CanvasNavigationManager::UpdateBlocksetSelectorState ( )

◆ QueueAdjacentMapsForPreload()

void yaze::editor::CanvasNavigationManager::QueueAdjacentMapsForPreload ( int center_map)

Queue the 4-connected neighbors of center_map for lazy build.

Definition at line 458 of file canvas_navigation_manager.cc.

References ctx_, yaze::zelda3::kNumOverworldMaps, yaze::zelda3::kSpecialWorldMapIdStart, yaze::editor::CanvasNavigationContext::overworld, yaze::zelda3::Overworld::overworld_map(), and preload_queue_.

Referenced by CheckForCurrentMap().

Here is the call graph for this function:

◆ ProcessPreloadQueue()

void yaze::editor::CanvasNavigationManager::ProcessPreloadQueue ( )

Process one map from the preload queue (call once per frame).

Definition at line 498 of file canvas_navigation_manager.cc.

References ctx_, yaze::zelda3::Overworld::EnsureMapBuilt(), LOG_DEBUG, yaze::editor::CanvasNavigationContext::overworld, and preload_queue_.

Referenced by CheckForCurrentMap().

Here is the call graph for this function:

Member Data Documentation

◆ ctx_

◆ callbacks_

CanvasNavigationCallbacks yaze::editor::CanvasNavigationManager::callbacks_
private

◆ last_hovered_map_

int yaze::editor::CanvasNavigationManager::last_hovered_map_ = -1
private

Definition at line 158 of file canvas_navigation_manager.h.

Referenced by CheckForCurrentMap().

◆ hover_time_

float yaze::editor::CanvasNavigationManager::hover_time_ = 0.0f
private

Definition at line 159 of file canvas_navigation_manager.h.

Referenced by CheckForCurrentMap().

◆ kHoverBuildDelay

constexpr float yaze::editor::CanvasNavigationManager::kHoverBuildDelay = 0.15f
staticconstexprprivate

Definition at line 160 of file canvas_navigation_manager.h.

Referenced by CheckForCurrentMap().

◆ preload_queue_

std::vector<int> yaze::editor::CanvasNavigationManager::preload_queue_
private

◆ kPreloadStartDelay

constexpr float yaze::editor::CanvasNavigationManager::kPreloadStartDelay = 0.3f
staticconstexprprivate

Definition at line 164 of file canvas_navigation_manager.h.

Referenced by CheckForCurrentMap().


The documentation for this class was generated from the following files: