Handles object selection, placement, and interaction within the dungeon canvas. More...
#include <dungeon_object_interaction.h>
Private Member Functions | |
| std::pair< int, int > | CalculateObjectBounds (const zelda3::RoomObject &object) |
| void | HandleLeftClick (const ImVec2 &canvas_mouse_pos) |
| void | UpdateCollisionPainting (const ImVec2 &canvas_mouse_pos) |
| void | UpdateWaterFillPainting (const ImVec2 &canvas_mouse_pos) |
| void | HandleObjectSelectionStart (const ImVec2 &canvas_mouse_pos) |
| void | HandleEmptySpaceClick (const ImVec2 &canvas_mouse_pos) |
| void | HandleMouseRelease () |
Private Attributes | |
| gui::Canvas * | canvas_ |
| zelda3::DungeonEditorSystem * | editor_system_ = nullptr |
| DungeonRoomStore * | rooms_ = nullptr |
| int | current_room_id_ = 0 |
| InteractionContext | interaction_context_ |
| InteractionCoordinator | entity_coordinator_ |
| InteractionModeManager | mode_manager_ |
| zelda3::RoomObject | preview_object_ {0, 0, 0, 0, 0} |
| gfx::PaletteGroup | current_palette_group_ |
| ObjectSelection | selection_ |
| std::function< void(const zelda3::RoomObject &) | object_placed_callback_ ) |
Handles object selection, placement, and interaction within the dungeon canvas.
This component manages mouse interactions for object selection (similar to OverworldEditor), object placement, drag operations, and multi-object selection.
Definition at line 42 of file dungeon_object_interaction.h.
|
inlineexplicit |
Definition at line 44 of file dungeon_object_interaction.h.
References yaze::editor::InteractionContext::canvas, entity_coordinator_, interaction_context_, yaze::editor::InteractionContext::selection, selection_, and yaze::editor::InteractionCoordinator::SetContext().

|
inline |
Set the unified interaction context.
This is the preferred method for configuring the interaction handler. It propagates context to all sub-handlers.
Definition at line 61 of file dungeon_object_interaction.h.
References yaze::editor::InteractionContext::canvas, canvas_, entity_coordinator_, interaction_context_, yaze::editor::InteractionContext::selection, selection_, and yaze::editor::InteractionCoordinator::SetContext().

|
inline |
Get the interaction coordinator for entity handling.
Use this for advanced entity operations (doors, sprites, items).
Definition at line 73 of file dungeon_object_interaction.h.
References entity_coordinator_.
Referenced by yaze::editor::ObjectSelectorContent::Draw().
|
inline |
Definition at line 74 of file dungeon_object_interaction.h.
References entity_coordinator_.
|
inline |
Definition at line 80 of file dungeon_object_interaction.h.
References interaction_context_, and yaze::editor::InteractionContext::last_mutation_domain.
|
inline |
Definition at line 83 of file dungeon_object_interaction.h.
References interaction_context_, and yaze::editor::InteractionContext::last_invalidation_domain.
|
inline |
Definition at line 88 of file dungeon_object_interaction.h.
References entity_coordinator_, interaction_context_, yaze::editor::InteractionContext::rom, and yaze::editor::InteractionCoordinator::SetContext().
Referenced by yaze::editor::DungeonCanvasViewer::DungeonCanvasViewer(), yaze::editor::DungeonCanvasViewer::SetContext(), and yaze::editor::DungeonCanvasViewer::SetRom().

| void yaze::editor::DungeonObjectInteraction::HandleCanvasMouseInput | ( | ) |
Definition at line 24 of file dungeon_object_interaction.cc.
References CancelPlacement(), canvas_, yaze::editor::DraggingObjects, entity_coordinator_, yaze::editor::InteractionModeManager::GetMode(), yaze::editor::InteractionCoordinator::HandleDrag(), HandleLayerKeyboardShortcuts(), HandleLeftClick(), HandleMouseRelease(), yaze::editor::InteractionCoordinator::HandleMouseWheel(), yaze::editor::InteractionCoordinator::HasEntitySelection(), yaze::gui::Canvas::IsMouseHovering(), yaze::editor::InteractionCoordinator::IsPlacementActive(), yaze::editor::ObjectSelection::IsRectangleSelectionActive(), mode_manager_, yaze::editor::PaintCollision, yaze::editor::PaintWaterFill, selection_, UpdateCollisionPainting(), UpdateWaterFillPainting(), and yaze::gui::Canvas::zero_point().
| void yaze::editor::DungeonObjectInteraction::CheckForObjectSelection | ( | ) |
Definition at line 288 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::PlaceObjectAtPosition | ( | int | room_x, |
| int | room_y ) |
Definition at line 449 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::DrawSelectionHighlights | ( | ) |
Definition at line 304 of file dungeon_object_interaction.cc.
References yaze::zelda3::DimensionService::Get(), yaze::zelda3::DimensionService::GetDimensions(), yaze::zelda3::GetObjectName(), yaze::zelda3::GetObjectSubtype(), ICON_MD_DRAG_INDICATOR, ICON_MD_MOUSE, and ICON_MD_TOUCH_APP.

| void yaze::editor::DungeonObjectInteraction::DrawHoverHighlight | ( | const std::vector< zelda3::RoomObject > & | objects | ) |
Definition at line 380 of file dungeon_object_interaction.cc.
References yaze::zelda3::DimensionService::Get(), and yaze::zelda3::DimensionService::GetSelectionBoundsPixels().

| void yaze::editor::DungeonObjectInteraction::DrawGhostPreview | ( | ) |
Definition at line 576 of file dungeon_object_interaction.cc.
| std::pair< int, int > yaze::editor::DungeonObjectInteraction::RoomToCanvasCoordinates | ( | int | room_x, |
| int | room_y ) const |
Definition at line 461 of file dungeon_object_interaction.cc.
| std::pair< int, int > yaze::editor::DungeonObjectInteraction::CanvasToRoomCoordinates | ( | int | canvas_x, |
| int | canvas_y ) const |
Definition at line 467 of file dungeon_object_interaction.cc.
Referenced by UpdateCollisionPainting().
| bool yaze::editor::DungeonObjectInteraction::IsWithinCanvasBounds | ( | int | canvas_x, |
| int | canvas_y, | ||
| int | margin = 32 ) const |
Definition at line 473 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::SetCurrentRoom | ( | DungeonRoomStore * | rooms, |
| int | room_id ) |
Definition at line 485 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::SetPreviewObject | ( | const zelda3::RoomObject & | object, |
| bool | loaded ) |
Definition at line 495 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::DungeonCanvasViewer::ClearPreviewObject(), and yaze::editor::DungeonCanvasViewer::SetPreviewObject().
|
inline |
Definition at line 113 of file dungeon_object_interaction.h.
References yaze::editor::InteractionContext::current_palette_group, current_palette_group_, entity_coordinator_, interaction_context_, and yaze::editor::InteractionCoordinator::SetContext().
Referenced by yaze::editor::DungeonCanvasViewer::SetPreviewObject().

|
inline |
Definition at line 120 of file dungeon_object_interaction.h.
References mode_manager_.
Referenced by yaze::editor::CustomCollisionPanel::Draw(), yaze::editor::WaterFillPanel::Draw(), and yaze::editor::DungeonWorkbenchContent::DrawInspectorShelfRoom().
|
inline |
Definition at line 121 of file dungeon_object_interaction.h.
References mode_manager_.
|
inline |
Definition at line 124 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceObject.
Referenced by yaze::editor::ObjectSelectorContent::DrawInteractionSummary().

| void yaze::editor::DungeonObjectInteraction::CancelPlacement | ( | ) |
Definition at line 734 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::ObjectSelectorContent::CancelPlacement(), and HandleCanvasMouseInput().
| void yaze::editor::DungeonObjectInteraction::SetDoorPlacementMode | ( | bool | enabled, |
| zelda3::DoorType | type = zelda3::DoorType::NormalDoor ) |
Definition at line 675 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::DoorEditorContent::CancelPlacement(), and yaze::editor::DoorEditorContent::Draw().
|
inline |
Definition at line 133 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceDoor.

|
inline |
Definition at line 136 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetModeState(), mode_manager_, and yaze::editor::ModeState::preview_door_type.

|
inline |
Definition at line 139 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetModeState(), mode_manager_, yaze::zelda3::NormalDoor, and yaze::editor::ModeState::preview_door_type.

|
inline |
Definition at line 143 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::CancelCurrentMode(), yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceDoor.

| void yaze::editor::DungeonObjectInteraction::SetSpritePlacementMode | ( | bool | enabled, |
| uint8_t | sprite_id = 0 ) |
Definition at line 692 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::SpriteEditorPanel::DrawPlacementControls(), and yaze::editor::SpriteEditorPanel::DrawSpriteSelector().
|
inline |
Definition at line 151 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceSprite.

|
inline |
Definition at line 154 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetModeState(), mode_manager_, and yaze::editor::ModeState::preview_sprite_id.

|
inline |
Definition at line 157 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetModeState(), mode_manager_, and yaze::editor::ModeState::preview_sprite_id.

|
inline |
Definition at line 160 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::CancelCurrentMode(), yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceSprite.

| void yaze::editor::DungeonObjectInteraction::SetItemPlacementMode | ( | bool | enabled, |
| uint8_t | item_id = 0 ) |
Definition at line 709 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::ItemEditorPanel::DrawItemSelector(), and yaze::editor::ItemEditorPanel::DrawPlacementControls().
|
inline |
Definition at line 168 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceItem.

|
inline |
Definition at line 171 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetModeState(), mode_manager_, and yaze::editor::ModeState::preview_item_id.

|
inline |
Definition at line 174 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::GetModeState(), mode_manager_, and yaze::editor::ModeState::preview_item_id.

|
inline |
Definition at line 177 of file dungeon_object_interaction.h.
References yaze::editor::InteractionModeManager::CancelCurrentMode(), yaze::editor::InteractionModeManager::GetMode(), mode_manager_, and yaze::editor::PlaceItem.

|
inline |
Definition at line 184 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::GetSelectedIndices(), and selection_.
Referenced by yaze::editor::ObjectEditorContent::CopySelectedObjects(), yaze::editor::ObjectEditorContent::CycleObjectSelection(), yaze::editor::ObjectEditorContent::DeleteSelectedObjects(), yaze::editor::DungeonCanvasViewer::DrawDungeonCanvas(), yaze::editor::ObjectEditorContent::DuplicateSelectedObjects(), and yaze::editor::ObjectEditorContent::NudgeSelectedObjects().

|
inline |
Definition at line 187 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::Add, yaze::editor::ObjectSelection::ClearSelection(), selection_, and yaze::editor::ObjectSelection::SelectObject().
Referenced by yaze::editor::ObjectEditorContent::PasteObjects(), and yaze::editor::ObjectEditorContent::SelectAllObjects().

|
inline |
Definition at line 193 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::HasSelection(), yaze::editor::ObjectSelection::IsRectangleSelectionActive(), and selection_.

| void yaze::editor::DungeonObjectInteraction::ClearSelection | ( | ) |
Definition at line 523 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::ObjectEditorContent::DeselectAllObjects().
|
inline |
Definition at line 197 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::IsObjectSelected(), and selection_.

|
inline |
Definition at line 200 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::GetSelectionCount(), and selection_.
Referenced by yaze::editor::DungeonWorkbenchContent::DrawInspectorCompactSummary().

|
inline |
Definition at line 203 of file dungeon_object_interaction.h.
References selection_, and yaze::editor::ObjectSelection::SetSelectionChangedCallback().
Referenced by yaze::editor::ObjectEditorContent::SetupSelectionCallbacks().

| void yaze::editor::DungeonObjectInteraction::HandleScrollWheelResize | ( | ) |
Definition at line 580 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::HandleDeleteSelected | ( | ) |
Definition at line 530 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::DungeonCanvasViewer::DeleteSelectedObjects().
| void yaze::editor::DungeonObjectInteraction::HandleDeleteAllObjects | ( | ) |
Definition at line 542 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::HandleCopySelected | ( | ) |
Definition at line 547 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::HandlePasteObjects | ( | ) |
Definition at line 552 of file dungeon_object_interaction.cc.
|
inline |
Definition at line 216 of file dungeon_object_interaction.h.
References entity_coordinator_, yaze::editor::TileObjectHandler::HasClipboardData(), and yaze::editor::InteractionCoordinator::tile_handler().

| bool yaze::editor::DungeonObjectInteraction::SetObjectId | ( | size_t | index, |
| int16_t | id ) |
Definition at line 585 of file dungeon_object_interaction.cc.
| bool yaze::editor::DungeonObjectInteraction::SetObjectSize | ( | size_t | index, |
| uint8_t | size ) |
Definition at line 591 of file dungeon_object_interaction.cc.
| bool yaze::editor::DungeonObjectInteraction::SetObjectLayer | ( | size_t | index, |
| zelda3::RoomObject::LayerType | layer ) |
Definition at line 597 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::SendSelectedToLayer | ( | int | target_layer | ) |
Definition at line 609 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::SendSelectedToFront | ( | ) |
Definition at line 614 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::SendSelectedToBack | ( | ) |
Definition at line 619 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::BringSelectedForward | ( | ) |
Definition at line 624 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::SendSelectedBackward | ( | ) |
Definition at line 629 of file dungeon_object_interaction.cc.
|
inline |
Definition at line 240 of file dungeon_object_interaction.h.
References selection_, and yaze::editor::ObjectSelection::SetLayerFilter().

|
inline |
Definition at line 241 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::GetLayerFilter(), and selection_.

|
inline |
Definition at line 242 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::IsLayerFilterActive(), and selection_.

|
inline |
Definition at line 243 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::IsMaskModeActive(), and selection_.

|
inline |
Definition at line 244 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::GetLayerFilterName(), and selection_.

|
inline |
Definition at line 247 of file dungeon_object_interaction.h.
References selection_, and yaze::editor::ObjectSelection::SetLayersMerged().

|
inline |
Definition at line 248 of file dungeon_object_interaction.h.
References yaze::editor::ObjectSelection::AreLayersMerged(), and selection_.

| void yaze::editor::DungeonObjectInteraction::HandleLayerKeyboardShortcuts | ( | ) |
Definition at line 634 of file dungeon_object_interaction.cc.
Referenced by HandleCanvasMouseInput().
|
inline |
Definition at line 254 of file dungeon_object_interaction.h.
References object_placed_callback_.
|
inline |
Definition at line 258 of file dungeon_object_interaction.h.
References entity_coordinator_, interaction_context_, yaze::editor::InteractionContext::on_invalidate_cache, and yaze::editor::InteractionCoordinator::SetContext().

|
inline |
Definition at line 262 of file dungeon_object_interaction.h.
References entity_coordinator_, interaction_context_, yaze::editor::InteractionContext::on_mutation, and yaze::editor::InteractionCoordinator::SetContext().

|
inline |
Definition at line 266 of file dungeon_object_interaction.h.
References editor_system_.
Referenced by yaze::editor::DungeonCanvasViewer::SetEditorSystem().
| void yaze::editor::DungeonObjectInteraction::SelectEntity | ( | EntityType | type, |
| size_t | index ) |
Definition at line 726 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::ClearEntitySelection | ( | ) |
Definition at line 730 of file dungeon_object_interaction.cc.
Referenced by yaze::editor::DungeonCanvasViewer::DrawDungeonCanvas().
|
inline |
Definition at line 273 of file dungeon_object_interaction.h.
References entity_coordinator_, and yaze::editor::InteractionCoordinator::HasEntitySelection().
Referenced by HandleLeftClick().

|
inline |
Definition at line 276 of file dungeon_object_interaction.h.
References entity_coordinator_, and yaze::editor::InteractionCoordinator::GetSelectedEntity().

| void yaze::editor::DungeonObjectInteraction::DrawEntitySelectionHighlights | ( | ) |
Definition at line 741 of file dungeon_object_interaction.cc.
| void yaze::editor::DungeonObjectInteraction::DrawDoorSnapIndicators | ( | ) |
Definition at line 746 of file dungeon_object_interaction.cc.
|
inline |
Definition at line 285 of file dungeon_object_interaction.h.
References entity_coordinator_, interaction_context_, yaze::editor::InteractionContext::on_entity_changed, and yaze::editor::InteractionCoordinator::SetContext().

|
private |
Definition at line 604 of file dungeon_object_interaction.cc.
References yaze::zelda3::DimensionService::Get(), and yaze::zelda3::DimensionService::GetPixelDimensions().

|
private |
Definition at line 92 of file dungeon_object_interaction.cc.
References entity_coordinator_, yaze::editor::InteractionCoordinator::HandleClick(), HandleEmptySpaceClick(), HandleObjectSelectionStart(), HasEntitySelection(), yaze::editor::ObjectSelection::HasSelection(), and selection_.
Referenced by HandleCanvasMouseInput().
|
private |
Definition at line 109 of file dungeon_object_interaction.cc.
References CanvasToRoomCoordinates(), current_room_id_, yaze::editor::paint_util::ForEachPointInSquareBrush(), yaze::editor::paint_util::ForEachPointOnLine(), yaze::editor::InteractionModeManager::GetModeState(), interaction_context_, yaze::editor::ModeState::is_painting, yaze::editor::kCustomCollision, mode_manager_, yaze::editor::InteractionContext::NotifyInvalidateCache(), yaze::editor::InteractionContext::NotifyMutation(), and rooms_.
Referenced by HandleCanvasMouseInput().
|
private |
Definition at line 168 of file dungeon_object_interaction.cc.
Referenced by HandleCanvasMouseInput().
|
private |
Definition at line 229 of file dungeon_object_interaction.cc.
Referenced by HandleLeftClick().
|
private |
Definition at line 238 of file dungeon_object_interaction.cc.
Referenced by HandleLeftClick().
|
private |
Definition at line 256 of file dungeon_object_interaction.cc.
Referenced by HandleCanvasMouseInput().
|
private |
Definition at line 291 of file dungeon_object_interaction.h.
Referenced by HandleCanvasMouseInput(), and SetContext().
|
private |
Definition at line 292 of file dungeon_object_interaction.h.
Referenced by SetEditorSystem().
|
private |
Definition at line 293 of file dungeon_object_interaction.h.
Referenced by UpdateCollisionPainting().
|
private |
Definition at line 294 of file dungeon_object_interaction.h.
Referenced by UpdateCollisionPainting().
|
private |
Definition at line 297 of file dungeon_object_interaction.h.
Referenced by DungeonObjectInteraction(), last_invalidation_domain(), last_mutation_domain(), SetCacheInvalidationCallback(), SetContext(), SetCurrentPaletteGroup(), SetEntityChangedCallback(), SetMutationCallback(), SetRom(), and UpdateCollisionPainting().
|
private |
Definition at line 298 of file dungeon_object_interaction.h.
Referenced by DungeonObjectInteraction(), entity_coordinator(), entity_coordinator(), GetSelectedEntity(), HandleCanvasMouseInput(), HandleLeftClick(), HasClipboardData(), HasEntitySelection(), SetCacheInvalidationCallback(), SetContext(), SetCurrentPaletteGroup(), SetEntityChangedCallback(), SetMutationCallback(), and SetRom().
|
private |
Definition at line 301 of file dungeon_object_interaction.h.
Referenced by CancelDoorPlacement(), CancelItemPlacement(), CancelSpritePlacement(), GetPreviewDoorType(), GetPreviewItemId(), GetPreviewSpriteId(), HandleCanvasMouseInput(), IsDoorPlacementActive(), IsItemPlacementActive(), IsObjectLoaded(), IsSpritePlacementActive(), mode_manager(), mode_manager(), SetPreviewDoorType(), SetPreviewItemId(), SetPreviewSpriteId(), and UpdateCollisionPainting().
|
private |
Definition at line 315 of file dungeon_object_interaction.h.
|
private |
Definition at line 318 of file dungeon_object_interaction.h.
Referenced by SetCurrentPaletteGroup().
|
private |
Definition at line 321 of file dungeon_object_interaction.h.
Referenced by AreLayersMerged(), DungeonObjectInteraction(), GetLayerFilter(), GetLayerFilterName(), GetSelectedObjectIndices(), GetSelectionCount(), HandleCanvasMouseInput(), HandleLeftClick(), IsLayerFilterActive(), IsMaskModeActive(), IsObjectSelectActive(), IsObjectSelected(), SetContext(), SetLayerFilter(), SetLayersMerged(), SetSelectedObjects(), and SetSelectionChangeCallback().
|
private |
Definition at line 324 of file dungeon_object_interaction.h.
Referenced by SetObjectPlacedCallback().