Skip to content

Commit

Permalink
fix wrong aspect ratio for pictos (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek authored Feb 14, 2024
1 parent cc108c8 commit de8e3de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 0 additions & 1 deletion teammapper-backend/src/map/services/maps.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class MapsService {
this.logger.warn(
`Parent with id ${clientNode.parent} does not exist for node ${clientNode.id} and map ${mapId}`
)
this.logger.warn(clientNodes.map((node) => [node.id, node.parent]))
return accCreatedNodes
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h2 mat-dialog-title>{{ 'MODALS.PICTOGRAMS.TITLE' | translate }}</h2>
</button>
</mat-form-field>
<ng-container *ngIf="cardLayout | async as layout">
<mat-grid-list cols="2" rowHeight="2:1" [cols]="layout.columns">
<mat-grid-list rowHeight="2:1" [cols]="layout.columns">
<div *ngIf="!pictos">{{ 'MODALS.PICTOGRAMS.EMPTY' | translate }}</div>
<mat-grid-tile *ngFor="let picto of pictos;" [colspan]="layout.miniCard.cols" [rowspan]="layout.miniCard.rows" class="image-wrapper">
<img ngSrc="{{getImageUrlOfId(picto._id)}}" (click)="getImageFileOfId(picto._id)" width="150" height="150">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Component, EventEmitter, HostListener } from '@angular/core';
import { IPictogramResponse } from 'src/app/core/services/pictograms/picto-types';
import { PictogramService } from 'src/app/core/services/pictograms/pictogram.service';
import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout';
import {
Breakpoints,
BreakpointObserver,
BreakpointState,
} from '@angular/cdk/layout';
import { map } from 'rxjs/operators';
import { MmpService } from 'src/app/core/services/mmp/mmp.service';
import { UtilsService } from 'src/app/core/services/utils/utils.service';
Expand All @@ -16,18 +20,25 @@ export class DialogPictogramsComponent {
public onPictogramAdd = new EventEmitter();
public searchTerm = '';
public cardLayout = this.breakpointObserver
.observe([Breakpoints.Handset])
.observe([Breakpoints.WebLandscape, Breakpoints.TabletLandscape])
.pipe(
map(({ matches }) => {
if (matches) {
map((state: BreakpointState) => {
if (state.breakpoints[Breakpoints.TabletLandscape]) {
return {
columns: 1,
columns: 2,
miniCard: { cols: 1, rows: 1 },
};
}

if (state.breakpoints[Breakpoints.WebLandscape]) {
return {
columns: 4,
miniCard: { cols: 1, rows: 1 },
};
}

return {
columns: 4,
columns: 1,
miniCard: { cols: 1, rows: 1 },
};
})
Expand Down

0 comments on commit de8e3de

Please sign in to comment.