Fix igc example migrating map postcompose event

This commit is contained in:
Florent gravin
2018-11-16 10:39:35 +01:00
committed by Tim Schaub
parent 1dbe52d738
commit 7831a591f7
4 changed files with 6 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ function flash(feature) {
unByKey(listenerKey);
return;
}
// tell OpenLayers to continue postcompose animation
// tell OpenLayers to continue postrender animation
map.render();
}
}

View File

@@ -161,7 +161,7 @@ const moveFeature = function(event) {
const feature = new Feature(currentPoint);
vectorContext.drawFeature(feature, styles.geoMarker);
}
// tell OpenLayers to continue the postcompose animation
// tell OpenLayers to continue the postrender animation
map.render();
};

View File

@@ -5,7 +5,7 @@ shortdesc: View a portion of one layer over another
docs: >
<p>Layer rendering can be manipulated in <code>prerender</code> and <code>postrender</code> event listeners.
These listeners get an event with a reference to the Canvas rendering context.
In this example, the <code>precompose</code> listener sets a clipping mask around the most
In this example, the <code>prerender</code> listener sets a clipping mask around the most
recent mouse position, giving you a spyglass effect for viewing one layer over another.</p>
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
tags: "spy, image manipulation"

View File

@@ -5,6 +5,7 @@ import {LineString, Point} from '../src/ol/geom.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js';
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
import {getVectorContext} from '../src/ol/render';
const count = 20000;
@@ -104,8 +105,8 @@ const style = new Style({
})
});
map.on('postcompose', function(evt) {
const vectorContext = evt.vectorContext;
vector.on('postrender', function(evt) {
const vectorContext = getVectorContext(evt);
vectorContext.setStyle(style);
if (point !== null) {
vectorContext.drawGeometry(point);