-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rotation): add rotation button (#261)
* feat(map) acces to view rotation * feat(map) rotation button to reset view rotation (if map rotated) * feat(demo) map rotation & rotation button * refactor(radio-button) Cleaning component * refactor(igo-rotation-button) Placement on top * feat(rotation-button) Provide rotation to button. Pointing to "north" * refactor(rotation-button) rotationClass to rotationStyle * refactor(rotation-button) degree to radians * Update rotation-button.component.ts
- Loading branch information
Showing
15 changed files
with
96 additions
and
3 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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './rotation-button.component'; |
13 changes: 13 additions & 0 deletions
13
projects/geo/src/lib/map/rotation-button/rotation-button.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="igo-rotation-button-container"> | ||
<button | ||
*ngIf="map.getRotation() !== 0" | ||
mat-icon-button | ||
[matTooltip]="'igo.geo.mapButtons.resetRotation' | translate" | ||
matTooltipPosition="left" | ||
[color]="color" | ||
(click)="map.resetRotation()"> | ||
<mat-icon [ngStyle]="rotationStyle(map.getRotation())"> | ||
navigation | ||
</mat-icon> | ||
</button> | ||
</div> |
14 changes: 14 additions & 0 deletions
14
projects/geo/src/lib/map/rotation-button/rotation-button.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@import '../../../../../core/src/style/partial/core.variables'; | ||
|
||
.igo-rotation-button-container { | ||
width: $igo-icon-size; | ||
background-color: #fff; | ||
&:hover { | ||
background-color: #efefef; | ||
} | ||
} | ||
|
||
button, | ||
:host >>> button .mat-button-ripple-round { | ||
border-radius: 0; | ||
} |
37 changes: 37 additions & 0 deletions
37
projects/geo/src/lib/map/rotation-button/rotation-button.component.ts
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
import { IgoMap } from '../shared/map'; | ||
|
||
@Component({ | ||
selector: 'igo-rotation-button', | ||
templateUrl: './rotation-button.component.html', | ||
styleUrls: ['./rotation-button.component.scss'] | ||
}) | ||
export class RotationButtonComponent { | ||
@Input() | ||
get map(): IgoMap { | ||
return this._map; | ||
} | ||
set map(value: IgoMap) { | ||
this._map = value; | ||
} | ||
private _map: IgoMap; | ||
|
||
@Input() | ||
get color(): string { | ||
return this._color; | ||
} | ||
set color(value: string) { | ||
this._color = value; | ||
} | ||
private _color: string; | ||
|
||
constructor() {} | ||
|
||
rotationStyle(radians): {} { | ||
const rotation = 'rotate(' + radians + 'rad)'; | ||
return { | ||
'transform': rotation | ||
}; | ||
} | ||
} |
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