Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(legend): make the legend adapt with the scale level
- Loading branch information
Showing
9 changed files
with
126 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 34 additions & 27 deletions
61
packages/geo/src/lib/layer/layer-legend/layer-legend.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
<small *ngIf="legend.length === 0"> | ||
{{'igo.geo.layer.noLegendText' | translate}} | ||
</small> | ||
<ng-container *ngIf="legendItems$ | async as items"> | ||
<ng-container *ngIf="items.length; else noItems"> | ||
<ng-container *ngFor="let item of items"> | ||
<mat-list-item *ngIf="item.title"> | ||
<mat-icon | ||
id="legend-toggle" | ||
class="igo-chevron" | ||
mat-list-avatar | ||
igoCollapse | ||
[target]="legend" | ||
[collapsed]="false"> | ||
</mat-icon> | ||
<h4 matLine>{{item.title}}</h4> | ||
</mat-list-item> | ||
|
||
<div #legend class="igo-layer-legend" [ngClass]="{'with-title': item.title}"> | ||
<img | ||
*ngIf="item.url" | ||
src="{{(item.url | secureImage) | async}}" | ||
alt="{{'igo.geo.layer.loadingLegendText' | translate}}"> | ||
<div | ||
[ngStyle]="item.style" | ||
[innerHTML]="item.html" | ||
*ngIf="item.html"> | ||
</div> | ||
</div> | ||
</ng-container> | ||
</ng-container> | ||
|
||
<ng-template ngFor let-item [ngForOf]="legend"> | ||
<mat-list-item *ngIf="item.title"> | ||
<mat-icon | ||
id="legend-toggle" | ||
class="igo-chevron" | ||
mat-list-avatar | ||
igoCollapse | ||
[target]="legend" | ||
[collapsed]="false"> | ||
</mat-icon> | ||
<h4 matLine>{{item.title}}</h4> | ||
</mat-list-item> | ||
<ng-template #noItems> | ||
<small> | ||
{{'igo.geo.layer.noLegendText' | translate}} | ||
</small> | ||
</ng-template> | ||
|
||
<div #legend class="igo-layer-legend" [ngClass]="{'with-title': item.title}"> | ||
<img | ||
*ngIf="item.url" | ||
src="{{(item.url | secureImage) | async}}" | ||
alt="{{'igo.geo.layer.loadingLegendText' | translate}}"> | ||
<div | ||
[ngStyle]="item.style" | ||
[innerHTML]="item.html" | ||
*ngIf="item.html"> | ||
</div> | ||
</div> | ||
</ng-template> | ||
</ng-container> |
19 changes: 19 additions & 0 deletions
19
packages/geo/src/lib/layer/layer-legend/layer-legend.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters