update line-arrows example

as same behavior as  #13074

Co-Authored-By: Andreas Hocevar <211514+ahocevar@users.noreply.github.com>
This commit is contained in:
jeanpierre
2021-12-09 18:43:56 +01:00
parent 01c81373b3
commit fafcb65fff

View File

@@ -5,6 +5,7 @@ import View from '../src/ol/View.js';
import {Icon, Stroke, Style} from '../src/ol/style.js'; import {Icon, Stroke, Style} from '../src/ol/style.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js'; import {OSM, Vector as VectorSource} from '../src/ol/source.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js'; import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {get} from '../src/ol/proj.js';
const raster = new TileLayer({ const raster = new TileLayer({
source: new OSM(), source: new OSM(),
@@ -49,12 +50,19 @@ const vector = new VectorLayer({
style: styleFunction, style: styleFunction,
}); });
// Limit multi-world panning to one world east and west of the real world.
// Geometry coordinates have to be within that range.
const extent = get('EPSG:3857').getExtent().slice();
extent[0] += extent[0];
extent[2] += extent[2];
const map = new Map({ const map = new Map({
layers: [raster, vector], layers: [raster, vector],
target: 'map', target: 'map',
view: new View({ view: new View({
center: [-11000000, 4600000], center: [-11000000, 4600000],
zoom: 4, zoom: 4,
extent,
}), }),
}); });