diff --git a/src/components/ModalSettings.tsx b/src/components/ModalSettings.tsx index 991e8804..aa056a54 100644 --- a/src/components/ModalSettings.tsx +++ b/src/components/ModalSettings.tsx @@ -1,6 +1,6 @@ import React from 'react' 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 FieldArray from './FieldArray' @@ -59,6 +59,25 @@ class ModalSettingsInternal extends React.Component }); } + 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) { const terrain = { ...this.props.mapStyle.terrain, @@ -102,6 +121,7 @@ class ModalSettingsInternal extends React.Component const light = this.props.mapStyle.light || {}; const transition = this.props.mapStyle.transition || {}; const terrain = this.props.mapStyle.terrain || {} as TerrainSpecification; + const projection = this.props.mapStyle.projection || {} as ProjectionSpecification; return onChange={this.changeLightProperty.bind(this, "anchor")} /> + +