Skip to content

Commit

Permalink
fix(*): fix import/export and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Jun 4, 2019
1 parent 706a0d1 commit 1f655c8
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 98 deletions.
2 changes: 1 addition & 1 deletion demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import { AppComponent } from './app.component';

AppContextModule,

AppRoutingModule,
AppRoutingModule
],
bootstrap: [AppComponent]
})
Expand Down
11 changes: 3 additions & 8 deletions demo/src/app/common/action/action.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import {
Component,
OnInit,
OnDestroy
} from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';

import { Media, MediaOrientation, MediaService } from '@igo2/core';
import { ActionStore, ActionbarMode } from '@igo2/common';
import {Overlay} from '@angular/cdk/overlay';
import { Overlay } from '@angular/cdk/overlay';

@Component({
selector: 'app-action',
templateUrl: './action.component.html',
styleUrls: ['./action.component.scss']
})
export class AppActionComponent implements OnInit, OnDestroy {

public store = new ActionStore([]);

private added = false;
Expand Down Expand Up @@ -43,7 +38,7 @@ export class AppActionComponent implements OnInit, OnDestroy {
alert('Add!');
this.added = true;
this.store.updateActionsAvailability();
},
}
},
{
id: 'edit',
Expand Down
6 changes: 2 additions & 4 deletions demo/src/app/common/action/action.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { NgModule } from '@angular/core';
import { MatButtonModule, MatCardModule } from '@angular/material';

import { IgoActionModule } from '@igo2/common';
import { IgoActionModule, IgoContextMenuModule } from '@igo2/common';

import { AppActionComponent } from './action.component';
import { AppActionRoutingModule } from './action-routing.module';
import {IgoContextMenuModule} from '../../../../../packages/common/src/lib/context-menu/context-menu.module';

@NgModule({
declarations: [
AppActionComponent],
declarations: [AppActionComponent],
imports: [
AppActionRoutingModule,
MatButtonModule,
Expand Down
38 changes: 25 additions & 13 deletions demo/src/app/geo/search/search.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {
Component,
ElementRef,
OnDestroy,
OnInit,
ViewChild
} from '@angular/core';
import * as proj from 'ol/proj';

import { LanguageService } from '@igo2/core';
Expand All @@ -7,6 +13,7 @@ import {
FEATURE,
Feature,
FeatureMotion,
GoogleLinks,
IgoMap,
LayerService,
MapService,
Expand All @@ -19,15 +26,13 @@ import {
} from '@igo2/geo';

import { SearchState } from '@igo2/integration';
import { GoogleLinks} from '../../../../../packages/geo/src/lib/utils/googleLinks';

@Component({
selector: 'app-search',
templateUrl: './search.component.html',
styleUrls: ['./search.component.scss']
})
export class AppSearchComponent implements OnInit, OnDestroy {

public store = new ActionStore([]);

public map = new IgoMap({
Expand All @@ -46,7 +51,7 @@ export class AppSearchComponent implements OnInit, OnDestroy {

public osmLayer: Layer;

@ViewChild('mapBrowser', {read: ElementRef}) mapBrowser: ElementRef;
@ViewChild('mapBrowser', { read: ElementRef }) mapBrowser: ElementRef;

public lonlat;
public mapProjection: string;
Expand Down Expand Up @@ -88,7 +93,7 @@ export class AppSearchComponent implements OnInit, OnDestroy {

onSearch(event: { research: Research; results: SearchResult[] }) {
const results = event.results;
this.searchStore.state.updateAll({focused: false, selected: false});
this.searchStore.state.updateAll({ focused: false, selected: false });
const newResults = this.searchStore.entities$.value
.filter((result: SearchResult) => result.source !== event.research.source)
.concat(results);
Expand Down Expand Up @@ -151,12 +156,11 @@ export class AppSearchComponent implements OnInit, OnDestroy {
}

ngOnInit() {

this.store.load([
{
id: 'coordinates',
title: 'coordinates',
handler: this.onSearchCoordinate.bind(this),
handler: this.onSearchCoordinate.bind(this)
},
{
id: 'googleMaps',
Expand All @@ -176,17 +180,23 @@ export class AppSearchComponent implements OnInit, OnDestroy {
this.store.destroy();
}

onContextMenuOpen(event: { x: number, y: number }) {
onContextMenuOpen(event: { x: number; y: number }) {
const position = this.mapPosition(event);
const coord = this.mapService.getMap().ol.getCoordinateFromPixel(position);
this.mapProjection = this.mapService.getMap().projection;
this.lonlat = proj.transform(coord, this.mapProjection, 'EPSG:4326');
}

mapPosition(event: { x: number, y: number }) {
mapPosition(event: { x: number; y: number }) {
const contextmenuPoint = event;
contextmenuPoint.y = contextmenuPoint.y - this.mapBrowser.nativeElement.getBoundingClientRect().top + window.scrollY;
contextmenuPoint.x = contextmenuPoint.x - this.mapBrowser.nativeElement.getBoundingClientRect().left + window.scrollX;
contextmenuPoint.y =
contextmenuPoint.y -
this.mapBrowser.nativeElement.getBoundingClientRect().top +
window.scrollY;
contextmenuPoint.x =
contextmenuPoint.x -
this.mapBrowser.nativeElement.getBoundingClientRect().left +
window.scrollX;
const position = [contextmenuPoint.x, contextmenuPoint.y];
return position;
}
Expand All @@ -198,7 +208,7 @@ export class AppSearchComponent implements OnInit, OnDestroy {
for (const i in results) {
if (results.length > 0) {
results[i].request.subscribe((_results: SearchResult<Feature>[]) => {
this.onSearch({research: results[i], results: _results});
this.onSearch({ research: results[i], results: _results });
/*if (_results[i].source.options.title === 'Coordinates') {
this.onResultSelect(_results[0]);
}*/
Expand All @@ -213,6 +223,8 @@ export class AppSearchComponent implements OnInit, OnDestroy {
}

onOpenGoogleStreetView() {
window.open(GoogleLinks.getGoogleStreetViewLink(this.lonlat[0], this.lonlat[1]));
window.open(
GoogleLinks.getGoogleStreetViewLink(this.lonlat[0], this.lonlat[1])
);
}
}
10 changes: 6 additions & 4 deletions demo/src/app/geo/search/search.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ import {
MatTooltipModule
} from '@angular/material';

import { IgoPanelModule } from '@igo2/common';
import {
IgoPanelModule,
IgoActionbarModule,
IgoContextMenuModule
} from '@igo2/common';
import {
IgoFeatureModule,
IgoMapModule,
IgoSearchModule,
provideIChercheSearchSource,
Expand All @@ -23,9 +28,6 @@ import { IgoAppSearchModule } from '@igo2/integration';

import { AppSearchComponent } from './search.component';
import { AppSearchRoutingModule } from './search-routing.module';
import { IgoActionbarModule } from '../../../../../packages/common/src/lib/action/actionbar/actionbar.module';
import { IgoContextMenuModule } from '../../../../../packages/common/src/lib/context-menu/context-menu.module';
import { IgoFeatureModule } from '../../../../../packages/geo/src/lib/feature/feature.module';

@NgModule({
declarations: [AppSearchComponent],
Expand Down
103 changes: 94 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1f655c8

Please sign in to comment.