@ -31,7 +31,15 @@ import {
} from 'app/features/dimensions/editors' ;
import { ResourceFolderName , defaultTextConfig , MediaType } from 'app/features/dimensions/types' ;
import { defaultStyleConfig , GeometryTypeId , StyleConfig , TextAlignment , TextBaseline } from '../style/types' ;
import {
HorizontalAlign ,
VerticalAlign ,
defaultStyleConfig ,
GeometryTypeId ,
StyleConfig ,
TextAlignment ,
TextBaseline ,
} from '../style/types' ;
import { styleUsesText } from '../style/utils' ;
import { LayerContentInfo } from '../utils/getFeatures' ;
@ -101,6 +109,14 @@ export const StyleEditor = (props: Props) => {
onChange ( { . . . value , textConfig : { . . . value . textConfig , textBaseline : textBaseline } } ) ;
} ;
const onAlignHorizontalChange = ( alignHorizontal : HorizontalAlign ) = > {
onChange ( { . . . value , symbolAlign : { . . . value . symbolAlign , horizontal : alignHorizontal } } ) ;
} ;
const onAlignVerticalChange = ( alignVertical : VerticalAlign ) = > {
onChange ( { . . . value , symbolAlign : { . . . value . symbolAlign , vertical : alignVertical } } ) ;
} ;
const propertyOptions = useObservable ( settings ? . layerInfo ? ? of ( ) ) ;
const featuresHavePoints = propertyOptions ? . geometryType === GeometryTypeId . Point ;
const hasTextLabel = styleUsesText ( value ) ;
@ -200,24 +216,48 @@ export const StyleEditor = (props: Props) => {
/ >
< / Field >
{ ! settings ? . hideSymbol && (
< Field label = { 'Symbol' } >
< ResourceDimensionEditor
value = { value ? . symbol ? ? defaultStyleConfig . symbol }
context = { context }
onChange = { onSymbolChange }
item = {
{
settings : {
resourceType : MediaType.Icon ,
folderName : ResourceFolderName.Marker ,
placeholderText : hasTextLabel ? 'Select a symbol' : 'Select a symbol or add a text label' ,
placeholderValue : defaultStyleConfig.symbol.fixed ,
showSourceRadio : false ,
} ,
} as StandardEditorsRegistryItem
}
/ >
< / Field >
< >
< Field label = { 'Symbol' } >
< ResourceDimensionEditor
value = { value ? . symbol ? ? defaultStyleConfig . symbol }
context = { context }
onChange = { onSymbolChange }
item = {
{
settings : {
resourceType : MediaType.Icon ,
folderName : ResourceFolderName.Marker ,
placeholderText : hasTextLabel ? 'Select a symbol' : 'Select a symbol or add a text label' ,
placeholderValue : defaultStyleConfig.symbol.fixed ,
showSourceRadio : false ,
} ,
} as StandardEditorsRegistryItem
}
/ >
< / Field >
< Field label = { 'Symbol Vertical Align' } >
< RadioButtonGroup
value = { value ? . symbolAlign ? . vertical ? ? defaultStyleConfig . symbolAlign . vertical }
onChange = { onAlignVerticalChange }
options = { [
{ value : VerticalAlign.Top , label : capitalize ( VerticalAlign . Top ) } ,
{ value : VerticalAlign.Center , label : capitalize ( VerticalAlign . Center ) } ,
{ value : VerticalAlign.Bottom , label : capitalize ( VerticalAlign . Bottom ) } ,
] }
/ >
< / Field >
< Field label = { 'Symbol Horizontal Align' } >
< RadioButtonGroup
value = { value ? . symbolAlign ? . horizontal ? ? defaultStyleConfig . symbolAlign . horizontal }
onChange = { onAlignHorizontalChange }
options = { [
{ value : HorizontalAlign.Left , label : capitalize ( HorizontalAlign . Left ) } ,
{ value : HorizontalAlign.Center , label : capitalize ( HorizontalAlign . Center ) } ,
{ value : HorizontalAlign.Right , label : capitalize ( HorizontalAlign . Right ) } ,
] }
/ >
< / Field >
< / >
) }
< Field label = { 'Color' } >
< ColorDimensionEditor