Fix studio, add options for 'rotation' (see #2072)

This commit is contained in:
Pieter Vander Vennet 2024-08-11 19:54:37 +02:00
parent def7523334
commit 39ce276c46
14 changed files with 190 additions and 54 deletions

View file

@ -242,7 +242,9 @@ export interface LayerConfigJson {
/**
* Creates points to render on the map.
* This can render points for point-objects, lineobjects or areaobjects; use 'location' to indicate where it should be rendered
* This can render points for point-objects, lineobjects or areaobjects; use 'location' to indicate where it should be rendered.
*
* Note that all attributes - including [the calculated tags](https://github.com/pietervdvn/MapComplete/blob/develop/Docs/CalculatedTags.md) can be used to create the markers and lines
*
* group: pointrendering
*/

View file

@ -92,11 +92,12 @@ export default interface PointRenderingConfigJson {
/**
* question: What rotation should be applied on the icon?
* This is mostly useful for items that face a specific direction, such as surveillance cameras
* This is interpreted as css property for 'rotate', thus has to end with 'deg', e.g. `90deg`, `{direction}deg`, `calc(90deg - {camera:direction}deg)``
* This is interpreted as css property for 'rotate', thus has to end with 'deg', e.g. `90deg`, `{direction}deg`, `calc(90deg - {camera:direction}deg)`
*
* If the icon is shown on the projected centerpoint of a way, one can also use `_direction:centerpoint`
*
* suggestions: return [{if: "value={_direction:centerpoint}deg", then: "Point north if the icon is pointing up"}, {if: "value=calc( {_direction:centerpoint}deg + 90deg)", then: "Point east if the icon is pointing up"}, {if: "value=calc( {_direction:centerpoint}deg + 180deg)", then: "Point south if the icon is pointing up"},{if: "value=calc( {_direction:centerpoint}deg + 270deg)", then: "Point west if the icon is pointing up"}]
* types: Dynamic value ; string
* suggestions: return [{if: "value={_direction:centerpoint}deg", then: "Point the top of the icon towards the end of the way"}, {if: "value=calc( {_direction:centerpoint}deg + 90deg )", then: "Point the left of the icon towards the end of the way"}, {if: "value=calc( {_direction:centerpoint}deg - 90deg )", then: "Point the right of the icon towards the end of the way"}, {if: "value=calc( {_direction:centerpoint}deg + 180deg )", then: "Point the bottom of the icon towards the end of the way"}]
* ifunset: Do not rotate
*/
rotation?: string | TagRenderingConfigJson
@ -153,7 +154,6 @@ export default interface PointRenderingConfigJson {
* You can use most Tailwind-css classes, see https://tailwindcss.com/ for more information
* For example: `center bg-gray-500 mx-2 my-1 rounded-full`
* inline: Apply CSS-classes <b>{value}</b> to the entire container
* ifunset: Do not apply extra CSS-classes to the label
* types: Dynamic value ; string
* ifunset: Do not apply extra CSS-classes to the entire marker
* group: expert
@ -162,7 +162,7 @@ export default interface PointRenderingConfigJson {
/**
* question: If the map is pitched, should the icon stay parallel to the screen or to the groundplane?
* suggestions: return [{if: "value=canvas", then: "The icon will stay upward and not be transformed as if it sticks to the screen"}, {if: "value=map", then: "The icon will be transformed as if it were painted onto the ground. (Automatically sets rotationAlignment)"}]
* suggestions: return [{if: "value=canvas", alsoShowIf: "value=", then: "The icon will stay upward and not be transformed as if it sticks to the screen"}, {if: "value=map", then: "The icon will be transformed as if it were painted onto the ground. (Automatically sets rotationAlignment)"}]
* group: expert
*/
pitchAlignment?: "canvas" | "map" | TagRenderingConfigJson