mirror of
https://github.com/maputnik/editor.git
synced 2026-08-29 16:37:25 +00:00
Compare commits
12 Commits
main
...
7cc137b7db
| Author | SHA1 | Date | |
|---|---|---|---|
| 7cc137b7db | |||
| c0c71a8af8 | |||
| ddd0a663d0 | |||
| 63ae6ac069 | |||
| f9c8b40593 | |||
| c9a055a931 | |||
| ef31c6df06 | |||
| 82105d20b4 | |||
| 3770385d5b | |||
| 76f0ee8c2c | |||
| 65c18a5ed0 | |||
| 627bab4dd4 |
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import latest from '@maplibre/maplibre-gl-style-spec/dist/latest.json'
|
import latest from '@maplibre/maplibre-gl-style-spec/dist/latest.json'
|
||||||
import type {LightSpecification, StyleSpecification, TerrainSpecification, TransitionSpecification} from 'maplibre-gl'
|
import type {LightSpecification, ProjectionSpecification, StyleSpecification, TerrainSpecification, TransitionSpecification} from 'maplibre-gl'
|
||||||
import { WithTranslation, withTranslation } from 'react-i18next';
|
import { WithTranslation, withTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import FieldArray from './FieldArray'
|
import FieldArray from './FieldArray'
|
||||||
@@ -59,6 +59,25 @@ class ModalSettingsInternal extends React.Component<ModalSettingsInternalProps>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeProjectionProperty(property: keyof ProjectionSpecification, value: any) {
|
||||||
|
const projection = {
|
||||||
|
...this.props.mapStyle.projection,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value === undefined) {
|
||||||
|
delete projection[property];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// @ts-ignore
|
||||||
|
projection[property] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.onStyleChanged({
|
||||||
|
...this.props.mapStyle,
|
||||||
|
projection,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
changeTerrainProperty(property: keyof TerrainSpecification, value: any) {
|
changeTerrainProperty(property: keyof TerrainSpecification, value: any) {
|
||||||
const terrain = {
|
const terrain = {
|
||||||
...this.props.mapStyle.terrain,
|
...this.props.mapStyle.terrain,
|
||||||
@@ -102,6 +121,7 @@ class ModalSettingsInternal extends React.Component<ModalSettingsInternalProps>
|
|||||||
const light = this.props.mapStyle.light || {};
|
const light = this.props.mapStyle.light || {};
|
||||||
const transition = this.props.mapStyle.transition || {};
|
const transition = this.props.mapStyle.transition || {};
|
||||||
const terrain = this.props.mapStyle.terrain || {} as TerrainSpecification;
|
const terrain = this.props.mapStyle.terrain || {} as TerrainSpecification;
|
||||||
|
const projection = this.props.mapStyle.projection || {} as ProjectionSpecification;
|
||||||
|
|
||||||
return <Modal
|
return <Modal
|
||||||
data-wd-key="modal:settings"
|
data-wd-key="modal:settings"
|
||||||
@@ -208,6 +228,16 @@ class ModalSettingsInternal extends React.Component<ModalSettingsInternalProps>
|
|||||||
onChange={this.changeLightProperty.bind(this, "anchor")}
|
onChange={this.changeLightProperty.bind(this, "anchor")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<FieldEnum
|
||||||
|
label={"projection type"}
|
||||||
|
fieldSpec={latest.projection.type}
|
||||||
|
name="projection type"
|
||||||
|
value={projection.type as string}
|
||||||
|
options={['mercator', 'globe']}
|
||||||
|
default={latest.projection.type.default}
|
||||||
|
onChange={this.changeProjectionProperty.bind(this, "type")}
|
||||||
|
/>
|
||||||
|
|
||||||
<FieldColor
|
<FieldColor
|
||||||
label={t("Light color")}
|
label={t("Light color")}
|
||||||
fieldSpec={latest.light.color}
|
fieldSpec={latest.light.color}
|
||||||
|
|||||||
Reference in New Issue
Block a user