From 7831a591f7120c2b10926e0e09089e975bf70b2d Mon Sep 17 00:00:00 2001 From: Florent gravin Date: Fri, 16 Nov 2018 10:39:35 +0100 Subject: [PATCH] Fix igc example migrating map postcompose event --- examples/feature-animation.js | 2 +- examples/feature-move-animation.js | 2 +- examples/layer-spy.html | 2 +- examples/synthetic-points.js | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/feature-animation.js b/examples/feature-animation.js index 9e61145499..e0bba2e586 100644 --- a/examples/feature-animation.js +++ b/examples/feature-animation.js @@ -72,7 +72,7 @@ function flash(feature) { unByKey(listenerKey); return; } - // tell OpenLayers to continue postcompose animation + // tell OpenLayers to continue postrender animation map.render(); } } diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index a5119d3e97..50a38c7f8f 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -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(); }; diff --git a/examples/layer-spy.html b/examples/layer-spy.html index 952e52cc71..098bd87ad2 100644 --- a/examples/layer-spy.html +++ b/examples/layer-spy.html @@ -5,7 +5,7 @@ shortdesc: View a portion of one layer over another docs: >

Layer rendering can be manipulated in prerender and postrender event listeners. These listeners get an event with a reference to the Canvas rendering context. - In this example, the precompose listener sets a clipping mask around the most + In this example, the prerender listener sets a clipping mask around the most recent mouse position, giving you a spyglass effect for viewing one layer over another.

Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.

tags: "spy, image manipulation" diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 5f04f1ba46..2fb7c5f3ef 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -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);