Link interaction
This commit is contained in:
9
examples/link.html
Normal file
9
examples/link.html
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: Map Link
|
||||
shortdesc: Synchronizing map state with the URL.
|
||||
docs: >
|
||||
The `Link` interaction allows you to synchronize the map state with the URL.
|
||||
tags: "link, permalink, url, query, search, params"
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
20
examples/link.js
Normal file
20
examples/link.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import Link from '../src/ol/interaction/Link.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import View from '../src/ol/View.js';
|
||||
|
||||
const map = new Map({
|
||||
layers: [
|
||||
new TileLayer({
|
||||
source: new OSM(),
|
||||
}),
|
||||
],
|
||||
target: 'map',
|
||||
view: new View({
|
||||
center: [0, 0],
|
||||
zoom: 2,
|
||||
}),
|
||||
});
|
||||
|
||||
map.addInteraction(new Link());
|
||||
Reference in New Issue
Block a user