From fcc850e217e3f907c3951e077da52cec9dab1e40 Mon Sep 17 00:00:00 2001 From: Tim Deubler Date: Wed, 13 Sep 2023 12:17:55 +0200 Subject: [PATCH] added(display): LayerStyles backgroundColor now supports dynamic colors taking zoom level into account. updated docs Signed-off-by: Tim Deubler --- packages/core/src/styles/BoxStyle.ts | 16 ++----- packages/core/src/styles/CircleStyle.ts | 16 ++----- packages/core/src/styles/GenericStyle.ts | 16 ++----- packages/core/src/styles/LayerStyle.ts | 26 +++++----- packages/core/src/styles/LineStyle.ts | 9 ++-- packages/core/src/styles/PolygonStyle.ts | 16 ++----- packages/core/src/styles/RectStyle.ts | 16 ++----- packages/core/src/styles/SphereStyle.ts | 9 ++-- packages/core/src/styles/TextStyle.ts | 16 ++----- packages/core/src/styles/VerticalLineStyle.ts | 9 ++-- packages/display/src/displays/BasicDisplay.ts | 48 ++++++++++++++----- packages/display/src/displays/styleTools.ts | 19 ++++---- .../display/src/displays/webgl/Display.ts | 2 +- 13 files changed, 99 insertions(+), 119 deletions(-) diff --git a/packages/core/src/styles/BoxStyle.ts b/packages/core/src/styles/BoxStyle.ts index 237e06009..e5b6bdf0d 100644 --- a/packages/core/src/styles/BoxStyle.ts +++ b/packages/core/src/styles/BoxStyle.ts @@ -16,7 +16,7 @@ * SPDX-License-Identifier: Apache-2.0 * License-Filename: LICENSE */ -import {StyleValueFunction, StyleZoomRange} from './LayerStyle'; +import {Color, StyleValueFunction, StyleZoomRange} from './LayerStyle'; /** @@ -49,22 +49,16 @@ export interface BoxStyle { /** * Sets the color to fill the Box. * - * The color can be specified in the following ways: - * - CSS color names: "red" - * - RGB(A) values: "rgba(255,0,0,1.0)" - * - hexadecimal values: "#ff0000" + * @see {@link Color} for a detailed list of possible supported formats. */ - fill?: string | StyleValueFunction | StyleZoomRange; + fill?: Color | StyleValueFunction | StyleZoomRange; /** * Sets the stroke color of the Box. * - * The color can be specified in the following ways: - * - CSS color names: "red" - * - RGB(A) values: "rgba(255,0,0,1.0)" - * - hexadecimal values: "#ff0000" + * @see {@link Color} for a detailed list of possible supported formats. */ - stroke?: string | StyleValueFunction | StyleZoomRange; + stroke?: Color | StyleValueFunction | StyleZoomRange; /** * Sets the width of the stroke. diff --git a/packages/core/src/styles/CircleStyle.ts b/packages/core/src/styles/CircleStyle.ts index f2e6fdba3..ec0cceed2 100644 --- a/packages/core/src/styles/CircleStyle.ts +++ b/packages/core/src/styles/CircleStyle.ts @@ -16,7 +16,7 @@ * SPDX-License-Identifier: Apache-2.0 * License-Filename: LICENSE */ -import {StyleValueFunction, StyleZoomRange} from './LayerStyle'; +import {Color, StyleValueFunction, StyleZoomRange} from './LayerStyle'; /** * Interface for configuring the visual appearance of Circles. @@ -48,22 +48,16 @@ export interface CircleStyle { /** * Sets the color to fill the Circle. * - * The color can be specified in the following ways: - * - CSS color names: "red" - * - RGB(A) values: "rgba(255,0,0,1.0)" - * - hexadecimal values: "#ff0000" + * @see {@link Color} for a detailed list of possible supported formats. */ - fill?: string | StyleValueFunction | StyleZoomRange; + fill?: Color | StyleValueFunction | StyleZoomRange; /** * Sets the stroke color of the Circle. * - * The color can be specified in the following ways: - * - CSS color names: "red" - * - RGB(A) values: "rgba(255,0,0,1.0)" - * - hexadecimal values: "#ff0000" + * @see {@link Color} for a detailed list of possible supported formats. */ - stroke?: string | StyleValueFunction | StyleZoomRange; + stroke?: Color | StyleValueFunction | StyleZoomRange; /** * Sets the width of the stroke. diff --git a/packages/core/src/styles/GenericStyle.ts b/packages/core/src/styles/GenericStyle.ts index a75db214d..5c23e3075 100644 --- a/packages/core/src/styles/GenericStyle.ts +++ b/packages/core/src/styles/GenericStyle.ts @@ -16,7 +16,7 @@ * SPDX-License-Identifier: Apache-2.0 * License-Filename: LICENSE */ -import {StyleValueFunction, StyleZoomRange} from './LayerStyle'; +import {Color, StyleValueFunction, StyleZoomRange} from './LayerStyle'; import {LinearGradient} from '@here/xyz-maps-core'; /** @@ -95,23 +95,17 @@ export interface Style { * Sets the color to fill the shape. * This attribute is valid for Circle, Rect, Text and Polygon. * - * The color can be specified in the following ways: - * - CSS color names: "red" - * - RGB(A) values: "rgba(255,0,0,1.0)" - * - hexadecimal values: "#ff0000" + * @see {@link Color} for a detailed list of possible supported formats. */ - fill?: string | StyleValueFunction | StyleZoomRange | LinearGradient; + fill?: Color | StyleValueFunction | StyleZoomRange | LinearGradient; /** * Sets the stroke color of the shape. * This attribute is valid for Circle, Rect, Line, Text and Polygon. * - * The color can be specified in the following ways: - * - CSS color names: "red" - * - RGB(A) values: "rgba(255,0,0,1.0)" - * - hexadecimal values: "#ff0000" + * @see {@link Color} for a detailed list of possible supported formats. */ - stroke?: string | StyleValueFunction | StyleZoomRange; + stroke?: Color | StyleValueFunction | StyleZoomRange; /** * Sets the width of the stroke. diff --git a/packages/core/src/styles/LayerStyle.ts b/packages/core/src/styles/LayerStyle.ts index 7d604c5e3..816633c4d 100644 --- a/packages/core/src/styles/LayerStyle.ts +++ b/packages/core/src/styles/LayerStyle.ts @@ -19,18 +19,6 @@ import {Feature} from '../features/Feature'; import {Style} from './GenericStyle'; -import {ModelStyle} from '@here/xyz-maps-core'; -import Model from '@here/xyz-maps-display/src/displays/webgl/program/Model'; -import {LineStyle} from './LineStyle'; -import {VerticalLineStyle} from './VerticalLineStyle'; -import {Line} from '@here/xyz-maps-editor'; -import {PolygonStyle} from './PolygonStyle'; -import {RectStyle} from './RectStyle'; -import {CircleStyle} from './CircleStyle'; -import {ImageStyle} from './ImageStyle'; -import {BoxStyle} from './BoxStyle'; -import {SphereStyle} from './SphereStyle'; -import {TextStyle} from './TextStyle'; /** @@ -89,6 +77,18 @@ export type StyleGroup = Array