Skip to content

Instantly share code, notes, and snippets.

@odoe
Created January 11, 2016 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odoe/75319deae0b51a364fc6 to your computer and use it in GitHub Desktop.
Save odoe/75319deae0b51a364fc6 to your computer and use it in GitHub Desktop.
import Rx from 'rx';
import Cycle from '@cycle/core';
import { div, input, h4, makeDOMDriver } from '@cycle/dom';
import Map from 'esri/Map';
import MapView from 'esri/views/MapView';
import VectorTileLayer from 'esri/layers/VectorTileLayer';
function main({ DOM }) {
const tileLyr = new VectorTileLayer({
url: "https://www.arcgis.com/sharing/rest/content/items/f96366254a564adda1dc468b447ed956/resources/styles/root.json"
});
const map = new Map({
layers: [ tileLyr ]
});
const view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65],
ui: {
components: []
}
});
const changeZoom$ = DOM.select('#zoom')
.events('input')
.map(({ target }) => target.value)
.startWith(4)
.map(value => {
view.zoom = value;
return value;
});
return {
DOM: changeZoom$.map(value =>
div([
div([
'Zoom Level',
input('#zoom', { type: 'range', min: 1, max: 23, value })
]),
h4('Current Zoom: ' + value)
])
)
};
}
Cycle.run(main, {
DOM: makeDOMDriver('#app-container')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment