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 @@ ...@@ -9,6 +9,6 @@
</div> </div>
<!-- Columna derecha que contiene el componente del mapa --> <!-- Columna derecha que contiene el componente del mapa -->
<div class="right-column"> <div class="right-column">
<app-mapa></app-mapa> <app-mapa [interactivo]="false"></app-mapa>
</div> </div>
</div> </div>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<!-- Contenedor del mapa --> <!-- Contenedor del mapa -->
<div class="map-area"> <div class="map-area">
<app-mapa (celdaSeleccionada)="enCeldaSeleccionada($event)"></app-mapa> <app-mapa [interactivo]="true" (celdaSeleccionada)="enCeldaSeleccionada($event)"></app-mapa>
</div> </div>
</div> </div>
import { MapaService } from '../mapa.service'; import { MapaService } from '../mapa.service';
import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
@Component({ @Component({
...@@ -16,6 +16,7 @@ import { Component, OnInit, Output, EventEmitter } from '@angular/core'; ...@@ -16,6 +16,7 @@ import { Component, OnInit, Output, EventEmitter } from '@angular/core';
* emitir eventos para bloques seleccionados y no seleccionables. * emitir eventos para bloques seleccionados y no seleccionables.
*/ */
export class MapaComponent implements OnInit { export class MapaComponent implements OnInit {
@Input() interactivo: boolean = true;
@Output() celdaSeleccionada = new EventEmitter<{ id: string, row: number, col: number }>(); @Output() celdaSeleccionada = new EventEmitter<{ id: string, row: number, col: number }>();
@Output() celdaInvalidaClickeada = new EventEmitter<void>(); @Output() celdaInvalidaClickeada = new EventEmitter<void>();
mapMatrix: string[][] = []; mapMatrix: string[][] = [];
...@@ -92,6 +93,7 @@ export class MapaComponent implements OnInit { ...@@ -92,6 +93,7 @@ export class MapaComponent implements OnInit {
* @param col La columna en la matriz del mapa donde está el bloque. * @param col La columna en la matriz del mapa donde está el bloque.
*/ */
enCeldaClickeada(celdaId: string, row: number, col: number): void { enCeldaClickeada(celdaId: string, row: number, col: number): void {
if(this.interactivo){
if (this.esCeldaValida(celdaId,row,col)) { if (this.esCeldaValida(celdaId,row,col)) {
// Emitir también la fila y la columna // Emitir también la fila y la columna
...@@ -101,6 +103,9 @@ export class MapaComponent implements OnInit { ...@@ -101,6 +103,9 @@ export class MapaComponent implements OnInit {
alert('Esta casilla no es válida para selección.'); 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