Update translate features example
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import {
|
import {
|
||||||
@@ -8,15 +8,12 @@ import {
|
|||||||
Translate,
|
Translate,
|
||||||
defaults as defaultInteractions,
|
defaults as defaultInteractions,
|
||||||
} from '../src/ol/interaction.js';
|
} from '../src/ol/interaction.js';
|
||||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
import {fromLonLat} from '../src/ol/proj.js';
|
||||||
|
|
||||||
const raster = new TileLayer({
|
|
||||||
source: new OSM(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const vector = new VectorLayer({
|
const vector = new VectorLayer({
|
||||||
|
background: 'white',
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: 'data/geojson/countries.geojson',
|
url: 'https://openlayers.org/data/vector/us-states.json',
|
||||||
format: new GeoJSON(),
|
format: new GeoJSON(),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@@ -29,10 +26,10 @@ const translate = new Translate({
|
|||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
interactions: defaultInteractions().extend([select, translate]),
|
interactions: defaultInteractions().extend([select, translate]),
|
||||||
layers: [raster, vector],
|
layers: [vector],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new View({
|
view: new View({
|
||||||
center: [0, 0],
|
center: fromLonLat([-100, 38.5]),
|
||||||
zoom: 2,
|
zoom: 4,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user