Skip to content

declutterMode and other props not available on ol-style-text? #411

@vincerubinetti

Description

@vincerubinetti

Describe the bug

Here's some pseudo code of what I'm working on

<template> <Layers.OlVectorLayer> <Sources.OlSourceVector ref="geometryRef" :features="features"> <Map.OlFeature v-for="(feature, key) in features" :key="key" :properties="feature.getProperties()" > <!-- https://github.com/MelihAltintas/vue3-openlayers/issues/410 --> <Styles.OlStyle :key="JSON.stringify(scale.steps) + geometryOpacity" > <Styles.OlStyleStroke color="black" /> <Styles.OlStyleFill :color="  feature.get('id') === highlight  ? getCssVar('--theme')  : scale.getColor(  values?.[feature.get('id')]?.value,  geometryOpacity,  )  " /> <Styles.OlStyleText :text="feature.get('label')" font="16px 'Roboto Flex'" fill="black" :stroke="{ color: 'white', width: 2 }" declutterMode="none" /> </Styles.OlStyle> </Map.OlFeature> </Sources.OlSourceVector> </Layers.OlVectorLayer> </template>

Note the text styles. The docs for the component are missing several options from the Open Layers constructor, such as declutterMode (which I really need to turn off), keepUpright, etc.

Now looking at the demo docs page, I see I can use overrideStyleFunction, but then I'd have to more verbosely redfine everything that's within my Styles.OlStyle attributes, which imo is defeating the purpose of using the library.

Perhaps more importantly, looking at the source code, it appears like it's intended that all extraneous props are passed through to the constructor, though I could be reading it wrong:

return new Text(options);

const properties = usePropsAsObjectProperties(props);

Maybe something in that usePropsAsObjectProperties util func is preventing it from working? I've also tried different casings, e.g. declutter-mode, with no luck.

Affected version(s)

├── ol-contextmenu@5.5.0 ├── ol-ext@4.0.27 ├── ol@10.4.0 ├── vue@3.5.13 └── vue3-openlayers@11.3.3 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions