Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add globe/mercator button #963

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
38 changes: 20 additions & 18 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: deploy

on:
push:
branches: [ main ]
branches: [ globe ]

jobs:
deploy-pages:
Expand All @@ -29,23 +29,25 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist

# publish docker to GitHub registry
deploy-docker:
name: deploy/docker
runs-on: ubuntu-latest

if: ${{ github.event_name == 'push' }}

strategy:
fail-fast: false
# # publish docker to GitHub registry
# deploy-docker:
# name: deploy/docker
# runs-on: ubuntu-latest

steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- run: docker build -t ghcr.io/maplibre/maputnik:main .
- run: docker push ghcr.io/maplibre/maputnik:main
# if: ${{ github.event_name == 'push' }}

# strategy:
# fail-fast: false

# steps:
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - uses: actions/checkout@v4
# - run: docker build -t ghcr.io/maplibre/maputnik:main .
# - run: docker push ghcr.io/maplibre/maputnik:main
147 changes: 116 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.6.0",
"@maplibre/maplibre-gl-inspect": "^1.6.3",
"@maplibre/maplibre-gl-style-spec": "^20.1.1",
"@maplibre/maplibre-gl-style-spec": "^20.3.1",
"@mdi/js": "^7.4.47",
"@mdi/react": "^1.6.1",
"@typescript-eslint/eslint-plugin": "^7.3.1",
Expand All @@ -53,7 +53,7 @@
"lodash.get": "^4.4.2",
"lodash.isequal": "^4.5.0",
"lodash.throttle": "^4.1.1",
"maplibre-gl": "^4.1.2",
"maplibre-gl": "^5.0.0",
"maputnik-design": "github:maputnik/design#172b06c",
"ol": "^6.14.1",
"ol-mapbox-style": "^7.1.1",
Expand Down
32 changes: 31 additions & 1 deletion src/components/ModalSettings.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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) {
const terrain = {
...this.props.mapStyle.terrain,
Expand Down Expand Up @@ -102,6 +121,7 @@ class ModalSettingsInternal extends React.Component<ModalSettingsInternalProps>
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 <Modal
data-wd-key="modal:settings"
Expand Down Expand Up @@ -208,6 +228,16 @@ class ModalSettingsInternal extends React.Component<ModalSettingsInternalProps>
onChange={this.changeLightProperty.bind(this, "anchor")}
/>

<FieldEnum
label={"projection type"}
fieldSpec={latest.projection.type}
name="projection type"
value={projection.type as string}
options={Object.keys(latest.projection.type.values)}
default={latest.projection.type.default}
onChange={this.changeProjectionProperty.bind(this, "type")}
/>

<FieldColor
label={t("Light color")}
fieldSpec={latest.light.color}
Expand Down
Loading