Skip to content

Commit

Permalink
fix(context): save button saves also view
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Sep 8, 2017
1 parent b352b3a commit f3a991f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/lib/context/context-item/context-item.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<md-list-item>
<md-icon md-list-avatar>{{context.icon ? context.icon : 'star'}}</md-icon>
<h4 [ngClass]="{'hiddenTitle': !collapsed}" mdLine>{{context.title}}</h4>
<h4 mdLine>{{context.title}}</h4>

<div *ngIf="auth.authenticated && context.permission === typePermission[typePermission.read]"
igoStopPropagation
Expand Down Expand Up @@ -38,13 +38,13 @@ <h4 [ngClass]="{'hiddenTitle': !collapsed}" mdLine>{{context.title}}</h4>
<md-icon>perm_identity</md-icon>
</button>

<button
<!--button
md-icon-button
[md-tooltip]="'igo.context.manageTools' | translate"
[color]="color"
(click)="manageTools.emit(context)">
<md-icon>widgets</md-icon>
</button>
</button-->

<button
md-icon-button
Expand Down
5 changes: 0 additions & 5 deletions src/lib/context/context-item/context-item.component.styl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ md-list-item >>> .mat-list-item-content .mat-list-text > h4 {
padding: 0 16px;
}

h4.hiddenTitle {
visibility: hidden;
padding: 0;
}

md-icon.disabled {
color: rgba(0,0,0,.38);
}
16 changes: 14 additions & 2 deletions src/lib/context/context-list/context-list-binding.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ export class ContextListBindingDirective implements OnInit, OnDestroy {
}

@HostListener('save', ['$event']) onSave(context: Context) {
const layers = this.mapService.getMap().layers$.getValue();
const map = this.mapService.getMap();
const view = map.ol.getView();
const proj = view.getProjection().getCode();
const center: any = new ol.geom.Point(view.getCenter()).transform(proj, 'EPSG:4326');
const layers = map.layers$.getValue();

const changes = {
layers: []
layers: [],
map: {
view: {
center: center.getCoordinates(),
zoom: view.getZoom(),
projection: proj
}
}
};

let order = layers.length;
Expand Down

0 comments on commit f3a991f

Please sign in to comment.