Skip to content

Commit

Permalink
fix(example.raster): allow example project to work in --aot mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davinkevin committed Jun 8, 2018
1 parent 72e53c3 commit ca0c9bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"ngx-openlayers": "^0.8.16",
"ngx-openlayers": "^0.8.21",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
Expand Down
4 changes: 2 additions & 2 deletions example/src/app/raster/raster.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
<span>Contrast : </span>
<input type="range" min="-255" max="255"
[(ngModel)]="contrast"
(input)="raster1.instance.changed(); raster2.instance.changed()" />
(input)="updateRaster()" />
<span> ({{ contrast }})</span>
</div>
<div class="control">
<span>Brightness : </span>
<input type="range" min="-255" max="255"
[(ngModel)]="brightness"
(input)="raster1.instance.changed(); raster2.instance.changed()" />
(input)="updateRaster()" />
<span> ({{ brightness }})</span>
</div>
14 changes: 10 additions & 4 deletions example/src/app/raster/raster.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import {Component, ViewChild} from '@angular/core';
import {SourceRasterComponent} from 'ngx-openlayers';

interface RasterData {
brightness: number;
Expand All @@ -15,15 +16,16 @@ export class RasterComponent {
operationType = 'image';
lib: any = {
brightness: brightness,
contrast: contrast
contrast: contrast,
};
brightness = 0;
contrast = 0;

selectLayer = 'osm';
@ViewChild(SourceRasterComponent) currentRasterSource;

beforeOperations(event) {
let data: RasterData = event.data;
const data: RasterData = event.data;
data.brightness = this.brightness;
data.contrast = this.contrast;
}
Expand All @@ -35,7 +37,11 @@ export class RasterComponent {
return imageData;
}

afterOperations() { }
afterOperations() {}

updateRaster() {
this.currentRasterSource.instance.changed();
}
}

/**
Expand Down

0 comments on commit ca0c9bb

Please sign in to comment.