mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 09:20:26 +01:00
Merge pull request #524 from orangemug/feature/ol-improvements
Further OpenLayers improvements
This commit is contained in:
commit
827bd5fa24
10 changed files with 259 additions and 41 deletions
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -8356,6 +8356,11 @@
|
||||||
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=",
|
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"lodash.get": {
|
||||||
|
"version": "4.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||||
|
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||||
|
},
|
||||||
"lodash.isequal": {
|
"lodash.isequal": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
"lodash.capitalize": "^4.2.1",
|
"lodash.capitalize": "^4.2.1",
|
||||||
"lodash.clamp": "^4.0.3",
|
"lodash.clamp": "^4.0.3",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
|
"lodash.get": "^4.4.2",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"mapbox-gl": "^0.53.1",
|
"mapbox-gl": "^0.53.1",
|
||||||
|
|
|
@ -2,6 +2,7 @@ import autoBind from 'react-autobind';
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import cloneDeep from 'lodash.clonedeep'
|
import cloneDeep from 'lodash.clonedeep'
|
||||||
import clamp from 'lodash.clamp'
|
import clamp from 'lodash.clamp'
|
||||||
|
import get from 'lodash.get'
|
||||||
import {arrayMove} from 'react-sortable-hoc'
|
import {arrayMove} from 'react-sortable-hoc'
|
||||||
import url from 'url'
|
import url from 'url'
|
||||||
|
|
||||||
|
@ -218,6 +219,9 @@ export default class App extends React.Component {
|
||||||
showCollisionBoxes: false,
|
showCollisionBoxes: false,
|
||||||
showOverdrawInspector: false,
|
showOverdrawInspector: false,
|
||||||
},
|
},
|
||||||
|
openlayersDebugOptions: {
|
||||||
|
debugToolbox: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
this.layerWatcher = new LayerWatcher({
|
this.layerWatcher = new LayerWatcher({
|
||||||
|
@ -276,6 +280,27 @@ export default class App extends React.Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChangeMetadataProperty = (property, value) => {
|
||||||
|
// If we're changing renderer reset the map state.
|
||||||
|
if (
|
||||||
|
property === 'maputnik:renderer' &&
|
||||||
|
value !== get(this.state.mapStyle, ['metadata', 'maputnik:renderer'], 'mbgljs')
|
||||||
|
) {
|
||||||
|
this.setState({
|
||||||
|
mapState: 'map'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const changedStyle = {
|
||||||
|
...this.state.mapStyle,
|
||||||
|
metadata: {
|
||||||
|
...this.state.mapStyle.metadata,
|
||||||
|
[property]: value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.onStyleChanged(changedStyle)
|
||||||
|
}
|
||||||
|
|
||||||
onStyleChanged = (newStyle, save=true) => {
|
onStyleChanged = (newStyle, save=true) => {
|
||||||
|
|
||||||
const errors = validate(newStyle, latest)
|
const errors = validate(newStyle, latest)
|
||||||
|
@ -479,9 +504,10 @@ export default class App extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
mapRenderer() {
|
mapRenderer() {
|
||||||
|
const metadata = this.state.mapStyle.metadata || {};
|
||||||
|
|
||||||
const mapProps = {
|
const mapProps = {
|
||||||
mapStyle: style.replaceAccessTokens(this.state.mapStyle, {allowFallback: true}),
|
mapStyle: style.replaceAccessTokens(this.state.mapStyle, {allowFallback: true}),
|
||||||
options: this.state.mapboxGlDebugOptions,
|
|
||||||
onDataChange: (e) => {
|
onDataChange: (e) => {
|
||||||
this.layerWatcher.analyzeMap(e.map)
|
this.layerWatcher.analyzeMap(e.map)
|
||||||
this.fetchSources();
|
this.fetchSources();
|
||||||
|
@ -496,9 +522,12 @@ export default class App extends React.Component {
|
||||||
if(renderer === 'ol') {
|
if(renderer === 'ol') {
|
||||||
mapElement = <OpenLayersMap
|
mapElement = <OpenLayersMap
|
||||||
{...mapProps}
|
{...mapProps}
|
||||||
|
debugToolbox={this.state.openlayersDebugOptions.debugToolbox}
|
||||||
|
onLayerSelect={this.onLayerSelect}
|
||||||
/>
|
/>
|
||||||
} else {
|
} else {
|
||||||
mapElement = <MapboxGlMap {...mapProps}
|
mapElement = <MapboxGlMap {...mapProps}
|
||||||
|
options={this.state.mapboxGlDebugOptions}
|
||||||
inspectModeEnabled={this.state.mapState === "inspect"}
|
inspectModeEnabled={this.state.mapState === "inspect"}
|
||||||
highlightedLayer={this.state.mapStyle.layers[this.state.selectedLayerIndex]}
|
highlightedLayer={this.state.mapStyle.layers[this.state.selectedLayerIndex]}
|
||||||
onLayerSelect={this.onLayerSelect} />
|
onLayerSelect={this.onLayerSelect} />
|
||||||
|
@ -540,6 +569,15 @@ export default class App extends React.Component {
|
||||||
this.setModal(modalName, !this.state.isOpen[modalName]);
|
this.setModal(modalName, !this.state.isOpen[modalName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChangeOpenlayersDebug = (key, value) => {
|
||||||
|
this.setState({
|
||||||
|
openlayersDebugOptions: {
|
||||||
|
...this.state.openlayersDebugOptions,
|
||||||
|
[key]: value,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onChangeMaboxGlDebug = (key, value) => {
|
onChangeMaboxGlDebug = (key, value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
mapboxGlDebugOptions: {
|
mapboxGlDebugOptions: {
|
||||||
|
@ -555,6 +593,7 @@ export default class App extends React.Component {
|
||||||
const metadata = this.state.mapStyle.metadata || {}
|
const metadata = this.state.mapStyle.metadata || {}
|
||||||
|
|
||||||
const toolbar = <Toolbar
|
const toolbar = <Toolbar
|
||||||
|
renderer={this._getRenderer()}
|
||||||
mapState={this.state.mapState}
|
mapState={this.state.mapState}
|
||||||
mapStyle={this.state.mapStyle}
|
mapStyle={this.state.mapStyle}
|
||||||
inspectModeEnabled={this.state.mapState === "inspect"}
|
inspectModeEnabled={this.state.mapState === "inspect"}
|
||||||
|
@ -603,7 +642,9 @@ export default class App extends React.Component {
|
||||||
<DebugModal
|
<DebugModal
|
||||||
renderer={this._getRenderer()}
|
renderer={this._getRenderer()}
|
||||||
mapboxGlDebugOptions={this.state.mapboxGlDebugOptions}
|
mapboxGlDebugOptions={this.state.mapboxGlDebugOptions}
|
||||||
|
openlayersDebugOptions={this.state.openlayersDebugOptions}
|
||||||
onChangeMaboxGlDebug={this.onChangeMaboxGlDebug}
|
onChangeMaboxGlDebug={this.onChangeMaboxGlDebug}
|
||||||
|
onChangeOpenlayersDebug={this.onChangeOpenlayersDebug}
|
||||||
isOpen={this.state.isOpen.debug}
|
isOpen={this.state.isOpen.debug}
|
||||||
onOpenToggle={this.toggleModal.bind(this, 'debug')}
|
onOpenToggle={this.toggleModal.bind(this, 'debug')}
|
||||||
/>
|
/>
|
||||||
|
@ -615,8 +656,10 @@ export default class App extends React.Component {
|
||||||
<SettingsModal
|
<SettingsModal
|
||||||
mapStyle={this.state.mapStyle}
|
mapStyle={this.state.mapStyle}
|
||||||
onStyleChanged={this.onStyleChanged}
|
onStyleChanged={this.onStyleChanged}
|
||||||
|
onChangeMetadataProperty={this.onChangeMetadataProperty}
|
||||||
isOpen={this.state.isOpen.settings}
|
isOpen={this.state.isOpen.settings}
|
||||||
onOpenToggle={this.toggleModal.bind(this, 'settings')}
|
onOpenToggle={this.toggleModal.bind(this, 'settings')}
|
||||||
|
openlayersDebugOptions={this.state.openlayersDebugOptions}
|
||||||
/>
|
/>
|
||||||
<ExportModal
|
<ExportModal
|
||||||
mapStyle={this.state.mapStyle}
|
mapStyle={this.state.mapStyle}
|
||||||
|
|
|
@ -114,6 +114,7 @@ export default class Toolbar extends React.Component {
|
||||||
onToggleModal: PropTypes.func,
|
onToggleModal: PropTypes.func,
|
||||||
onSetMapState: PropTypes.func,
|
onSetMapState: PropTypes.func,
|
||||||
mapState: PropTypes.string,
|
mapState: PropTypes.string,
|
||||||
|
renderer: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -139,6 +140,7 @@ export default class Toolbar extends React.Component {
|
||||||
{
|
{
|
||||||
id: "inspect",
|
id: "inspect",
|
||||||
title: "Inspect",
|
title: "Inspect",
|
||||||
|
disabled: this.props.renderer !== 'mbgljs',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "filter-deuteranopia",
|
id: "filter-deuteranopia",
|
||||||
|
|
|
@ -34,6 +34,11 @@ class FeatureLayerPopup extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_getFeatureColor(feature, zoom) {
|
_getFeatureColor(feature, zoom) {
|
||||||
|
// Guard because openlayers won't have this
|
||||||
|
if (!feature.layer.paint) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const paintProps = feature.layer.paint;
|
const paintProps = feature.layer.paint;
|
||||||
let propName;
|
let propName;
|
||||||
|
@ -105,11 +110,13 @@ class FeatureLayerPopup extends React.Component {
|
||||||
this.props.onLayerSelect(feature.layer.id)
|
this.props.onLayerSelect(feature.layer.id)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<LayerIcon type={feature.layer.type} style={{
|
{feature.layer.type &&
|
||||||
width: 14,
|
<LayerIcon type={feature.layer.type} style={{
|
||||||
height: 14,
|
width: 14,
|
||||||
paddingRight: 3
|
height: 14,
|
||||||
}}/>
|
paddingRight: 3
|
||||||
|
}}/>
|
||||||
|
}
|
||||||
{feature.layer.id}
|
{feature.layer.id}
|
||||||
{feature.counter && <span> × {feature.counter}</span>}
|
{feature.counter && <span> × {feature.counter}</span>}
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -3,10 +3,26 @@ import {throttle} from 'lodash';
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { loadJSON } from '../../libs/urlopen'
|
import { loadJSON } from '../../libs/urlopen'
|
||||||
|
|
||||||
|
import FeatureLayerPopup from './FeatureLayerPopup';
|
||||||
|
|
||||||
import 'ol/ol.css'
|
import 'ol/ol.css'
|
||||||
import {apply} from 'ol-mapbox-style';
|
import {apply} from 'ol-mapbox-style';
|
||||||
import {Map, View} from 'ol';
|
import {Map, View, Proj, Overlay} from 'ol';
|
||||||
|
|
||||||
|
import {toLonLat} from 'ol/proj';
|
||||||
|
import {toStringHDMS} from 'ol/coordinate';
|
||||||
|
|
||||||
|
|
||||||
|
function renderCoords (coords) {
|
||||||
|
if (!coords || coords.length < 2) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return <span className="maputnik-coords">
|
||||||
|
{coords.map((coord) => String(coord).padStart(7, "\u00A0")).join(', ')}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default class OpenLayersMap extends React.Component {
|
export default class OpenLayersMap extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -14,15 +30,24 @@ export default class OpenLayersMap extends React.Component {
|
||||||
mapStyle: PropTypes.object.isRequired,
|
mapStyle: PropTypes.object.isRequired,
|
||||||
accessToken: PropTypes.string,
|
accessToken: PropTypes.string,
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
|
onLayerSelect: PropTypes.func.isRequired,
|
||||||
|
debugToolbox: PropTypes.bool.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
onMapLoaded: () => {},
|
onMapLoaded: () => {},
|
||||||
onDataChange: () => {},
|
onDataChange: () => {},
|
||||||
|
onLayerSelect: () => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
zoom: 0,
|
||||||
|
rotation: 0,
|
||||||
|
cursor: [],
|
||||||
|
center: [],
|
||||||
|
};
|
||||||
this.updateStyle = throttle(this._updateStyle.bind(this), 200);
|
this.updateStyle = throttle(this._updateStyle.bind(this), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,33 +59,108 @@ export default class OpenLayersMap extends React.Component {
|
||||||
apply(this.map, newMapStyle);
|
apply(this.map, newMapStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate(prevProps) {
|
||||||
this.updateStyle(this.props.mapStyle);
|
if (this.props.mapStyle !== prevProps.mapStyle) {
|
||||||
|
this.updateStyle(this.props.mapStyle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.updateStyle(this.props.mapStyle);
|
this.overlay = new Overlay({
|
||||||
|
element: this.popupContainer,
|
||||||
|
autoPan: true,
|
||||||
|
autoPanAnimation: {
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
target: this.container,
|
target: this.container,
|
||||||
layers: [],
|
overlays: [this.overlay],
|
||||||
view: new View({
|
view: new View({
|
||||||
zoom: 2,
|
zoom: 1,
|
||||||
center: [52.5, -78.4]
|
center: [180, -90],
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
map.on('pointermove', (evt) => {
|
||||||
|
var coords = toLonLat(evt.coordinate);
|
||||||
|
this.setState({
|
||||||
|
cursor: [
|
||||||
|
coords[0].toFixed(2),
|
||||||
|
coords[1].toFixed(2)
|
||||||
|
]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
map.on('postrender', (evt) => {
|
||||||
|
const center = toLonLat(map.getView().getCenter());
|
||||||
|
this.setState({
|
||||||
|
center: [
|
||||||
|
center[0].toFixed(2),
|
||||||
|
center[1].toFixed(2),
|
||||||
|
],
|
||||||
|
rotation: map.getView().getRotation().toFixed(2),
|
||||||
|
zoom: map.getView().getZoom().toFixed(2)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
this.updateStyle(this.props.mapStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeOverlay = (e) => {
|
||||||
|
e.target.blur();
|
||||||
|
this.overlay.setPosition(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div
|
return <div className="maputnik-ol-container">
|
||||||
ref={x => this.container = x}
|
<div
|
||||||
style={{
|
ref={x => this.popupContainer = x}
|
||||||
width: "100%",
|
style={{background: "black"}}
|
||||||
height: "100%",
|
className="maputnik-popup"
|
||||||
backgroundColor: '#fff',
|
>
|
||||||
...this.props.style,
|
<button
|
||||||
}}>
|
className="mapboxgl-popup-close-button"
|
||||||
|
onClick={this.closeOverlay}
|
||||||
|
aria-label="Close popup"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
<FeatureLayerPopup
|
||||||
|
features={this.state.selectedFeatures || []}
|
||||||
|
onLayerSelect={this.props.onLayerSelect}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="maputnik-ol-zoom">
|
||||||
|
Zoom level: {this.state.zoom}
|
||||||
|
</div>
|
||||||
|
{this.props.debugToolbox &&
|
||||||
|
<div className="maputnik-ol-debug">
|
||||||
|
<div>
|
||||||
|
<label>cursor: </label>
|
||||||
|
<span>{renderCoords(this.state.cursor)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>center: </label>
|
||||||
|
<span>{renderCoords(this.state.center)}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>rotation: </label>
|
||||||
|
<span>{this.state.rotation}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div
|
||||||
|
className="maputnik-ol"
|
||||||
|
ref={x => this.container = x}
|
||||||
|
style={{
|
||||||
|
...this.props.style,
|
||||||
|
}}>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@ class DebugModal extends React.Component {
|
||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
renderer: PropTypes.string.isRequired,
|
renderer: PropTypes.string.isRequired,
|
||||||
onChangeMaboxGlDebug: PropTypes.func.isRequired,
|
onChangeMaboxGlDebug: PropTypes.func.isRequired,
|
||||||
|
onChangeOpenlayersDebug: PropTypes.func.isRequired,
|
||||||
onOpenToggle: PropTypes.func.isRequired,
|
onOpenToggle: PropTypes.func.isRequired,
|
||||||
mapboxGlDebugOptions: PropTypes.object,
|
mapboxGlDebugOptions: PropTypes.object,
|
||||||
|
openlayersDebugOptions: PropTypes.object,
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -33,9 +35,15 @@ class DebugModal extends React.Component {
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
{this.props.renderer === 'ol' &&
|
{this.props.renderer === 'ol' &&
|
||||||
<div>
|
<ul>
|
||||||
No debug options available for the OpenLayers renderer
|
{Object.entries(this.props.openlayersDebugOptions).map(([key, val]) => {
|
||||||
</div>
|
return <li key={key}>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" checked={val} onClick={(e) => this.props.onChangeOpenlayersDebug(key, e.target.checked)} /> {key}
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -11,6 +11,7 @@ class SettingsModal extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
mapStyle: PropTypes.object.isRequired,
|
mapStyle: PropTypes.object.isRequired,
|
||||||
onStyleChanged: PropTypes.func.isRequired,
|
onStyleChanged: PropTypes.func.isRequired,
|
||||||
|
onChangeMetadataProperty: PropTypes.func.isRequired,
|
||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
onOpenToggle: PropTypes.func.isRequired,
|
onOpenToggle: PropTypes.func.isRequired,
|
||||||
}
|
}
|
||||||
|
@ -23,19 +24,9 @@ class SettingsModal extends React.Component {
|
||||||
this.props.onStyleChanged(changedStyle)
|
this.props.onStyleChanged(changedStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
changeMetadataProperty(property, value) {
|
|
||||||
const changedStyle = {
|
|
||||||
...this.props.mapStyle,
|
|
||||||
metadata: {
|
|
||||||
...this.props.mapStyle.metadata,
|
|
||||||
[property]: value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.props.onStyleChanged(changedStyle)
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const metadata = this.props.mapStyle.metadata || {}
|
const metadata = this.props.mapStyle.metadata || {}
|
||||||
|
const {onChangeMetadataProperty} = this.props;
|
||||||
const inputProps = { }
|
const inputProps = { }
|
||||||
return <Modal
|
return <Modal
|
||||||
data-wd-key="modal-settings"
|
data-wd-key="modal-settings"
|
||||||
|
@ -78,7 +69,7 @@ class SettingsModal extends React.Component {
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
data-wd-key="modal-settings.maputnik:mapbox_access_token"
|
data-wd-key="modal-settings.maputnik:mapbox_access_token"
|
||||||
value={metadata['maputnik:mapbox_access_token']}
|
value={metadata['maputnik:mapbox_access_token']}
|
||||||
onChange={this.changeMetadataProperty.bind(this, "maputnik:mapbox_access_token")}
|
onChange={onChangeMetadataProperty.bind(this, "maputnik:mapbox_access_token")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
|
@ -86,7 +77,7 @@ class SettingsModal extends React.Component {
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
data-wd-key="modal-settings.maputnik:openmaptiles_access_token"
|
data-wd-key="modal-settings.maputnik:openmaptiles_access_token"
|
||||||
value={metadata['maputnik:openmaptiles_access_token']}
|
value={metadata['maputnik:openmaptiles_access_token']}
|
||||||
onChange={this.changeMetadataProperty.bind(this, "maputnik:openmaptiles_access_token")}
|
onChange={onChangeMetadataProperty.bind(this, "maputnik:openmaptiles_access_token")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
|
@ -94,7 +85,7 @@ class SettingsModal extends React.Component {
|
||||||
<StringInput {...inputProps}
|
<StringInput {...inputProps}
|
||||||
data-wd-key="modal-settings.maputnik:thunderforest_access_token"
|
data-wd-key="modal-settings.maputnik:thunderforest_access_token"
|
||||||
value={metadata['maputnik:thunderforest_access_token']}
|
value={metadata['maputnik:thunderforest_access_token']}
|
||||||
onChange={this.changeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")}
|
onChange={onChangeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
|
@ -106,9 +97,10 @@ class SettingsModal extends React.Component {
|
||||||
['ol', 'Open Layers (experimental)'],
|
['ol', 'Open Layers (experimental)'],
|
||||||
]}
|
]}
|
||||||
value={metadata['maputnik:renderer'] || 'mbgljs'}
|
value={metadata['maputnik:renderer'] || 'mbgljs'}
|
||||||
onChange={this.changeMetadataProperty.bind(this, 'maputnik:renderer')}
|
onChange={onChangeMetadataProperty.bind(this, 'maputnik:renderer')}
|
||||||
/>
|
/>
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
//OPENLAYERS
|
//OPENLAYERS
|
||||||
.maputnik-layout {
|
.maputnik-layout {
|
||||||
.ol-zoom {
|
.ol-zoom {
|
||||||
top: 10px;
|
top: 40px;
|
||||||
|
right: 10px;
|
||||||
|
left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ol-rotate {
|
||||||
|
top: 94px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
left: auto;
|
left: auto;
|
||||||
}
|
}
|
||||||
|
@ -20,3 +26,57 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.maputnik-ol {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maputnik-ol-popup {
|
||||||
|
background: $color-black;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.maputnik-coords {
|
||||||
|
font-family: monospace;
|
||||||
|
&:before {
|
||||||
|
content: '[';
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
content: ']';
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.maputnik-ol-debug {
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: smaller;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
left: 10px;
|
||||||
|
background: rgb(28, 31, 36);
|
||||||
|
padding: 6px 8px;
|
||||||
|
border-radius: 2px;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maputnik-ol-zoom {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 10px;
|
||||||
|
background: #1c1f24;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 6px 8px;
|
||||||
|
color: $color-lowgray;
|
||||||
|
z-index: 9999;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maputnik-ol-container {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
.maputnik-popup-layer-id {
|
.maputnik-popup-layer-id {
|
||||||
padding-left: $margin-2;
|
padding-left: $margin-2;
|
||||||
padding-right: $margin-2;
|
padding-right: 1.6em;
|
||||||
background-color: $color-midgray;
|
background-color: $color-midgray;
|
||||||
color: $color-white;
|
color: $color-white;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue