Skip to content

Commit

Permalink
feat(geo): info content on map (#979)
Browse files Browse the repository at this point in the history
* feat(geo): info content on map

* feat(demo): add an example of infocontent
  • Loading branch information
pelord authored Feb 7, 2022
1 parent 2304568 commit 8e88f41
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions demo/src/app/geo/simple-map/simple-map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
igoPointerPosition
[pointerPositionDelay]="pointerCoordDelay"
(pointerPositionCoord)="onPointerMove($event)">
<igo-info-section [infoContent]="pointerCoord"></igo-info-section>
<igo-zoom-button [map]="map" color="primary"></igo-zoom-button>
<igo-geolocate-button [map]="map" color="primary"></igo-geolocate-button>
<igo-rotation-button [map]="map" [showIfNoRotation]="true" color="primary"></igo-rotation-button>
Expand Down
1 change: 1 addition & 0 deletions packages/geo/src/lib/map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from './baselayers-switcher';
export * from './rotation-button';
export * from './swipe-control';
export * from './map-center';
export * from './info-section';
1 change: 1 addition & 0 deletions packages/geo/src/lib/map/info-section/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './info-section.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div *ngIf="infoContent && infoContent.length" class="infoSection">
<pre>{{infoContent}}</pre>
</div>
16 changes: 16 additions & 0 deletions packages/geo/src/lib/map/info-section/info-section.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import '../../../../../core/src/style/partial/media';
@import '../../../../../core/src/style/partial/core.variables';

.infoSection {
border-radius: 10px;
background-color: rgba(110,110,110, 0.4);
padding: calc(#{$igo-margin} / 2);
position: absolute;
text-align: center;
top: $igo-margin;
left: 50%;
@include mobile {
top: calc(#{$igo-icon-size} + 5px + #{$igo-margin});
left: 10%;
}
}
14 changes: 14 additions & 0 deletions packages/geo/src/lib/map/info-section/info-section.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, Input } from '@angular/core';

@Component({
selector: 'igo-info-section',
templateUrl: './info-section.component.html',
styleUrls: ['./info-section.component.scss']
})
export class InfoSectionComponent {

@Input() infoContent: string = '';

constructor() {}

}
3 changes: 3 additions & 0 deletions packages/geo/src/lib/map/map.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { HoverFeatureDirective } from './shared/hover-feature.directive';
import { SwipeControlComponent } from './swipe-control/swipe-control.component';
import { MapCenterComponent } from './map-center/map-center.component';
import { MenuButtonComponent } from './menu-button/menu-button.component';
import { InfoSectionComponent } from './info-section/info-section.component';

@NgModule({
imports: [
Expand All @@ -33,6 +34,7 @@ import { MenuButtonComponent } from './menu-button/menu-button.component';
ZoomButtonComponent,
GeolocateButtonComponent,
RotationButtonComponent,
InfoSectionComponent,
BaseLayersSwitcherComponent,
MiniBaseMapComponent,
MapOfflineDirective,
Expand All @@ -48,6 +50,7 @@ import { MenuButtonComponent } from './menu-button/menu-button.component';
ZoomButtonComponent,
GeolocateButtonComponent,
RotationButtonComponent,
InfoSectionComponent,
BaseLayersSwitcherComponent,
MiniBaseMapComponent,
MapOfflineDirective,
Expand Down

0 comments on commit 8e88f41

Please sign in to comment.