Commit bfd54a46 by Alex

Agregada lógica de mapa no interactuable en la pantalla principal, pero sí en el pop-up

parent de0dd333
......@@ -9,6 +9,6 @@
</div>
<!-- Columna derecha que contiene el componente del mapa -->
<div class="right-column">
<app-mapa></app-mapa>
<app-mapa [interactivo]="false"></app-mapa>
</div>
</div>
......@@ -27,7 +27,7 @@
<!-- Contenedor del mapa -->
<div class="map-area">
<app-mapa (celdaSeleccionada)="enCeldaSeleccionada($event)"></app-mapa>
<app-mapa [interactivo]="true" (celdaSeleccionada)="enCeldaSeleccionada($event)"></app-mapa>
</div>
</div>
import { MapaService } from '../mapa.service';
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
@Component({
......@@ -16,6 +16,7 @@ import { Component, OnInit, Output, EventEmitter } from '@angular/core';
* emitir eventos para bloques seleccionados y no seleccionables.
*/
export class MapaComponent implements OnInit {
@Input() interactivo: boolean = true;
@Output() celdaSeleccionada = new EventEmitter<{ id: string, row: number, col: number }>();
@Output() celdaInvalidaClickeada = new EventEmitter<void>();
mapMatrix: string[][] = [];
......@@ -92,6 +93,7 @@ export class MapaComponent implements OnInit {
* @param col La columna en la matriz del mapa donde está el bloque.
*/
enCeldaClickeada(celdaId: string, row: number, col: number): void {
if(this.interactivo){
if (this.esCeldaValida(celdaId,row,col)) {
// Emitir también la fila y la columna
......@@ -101,6 +103,9 @@ export class MapaComponent implements OnInit {
alert('Esta casilla no es válida para selección.');
}
}
}else{
return;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment