Skip to content

Highlight

Paint selected / identified features. Needs LayerHighlight on the map (enableClick / enableHover).

Events: none. Duration comes from LayerHighlight (durationMs).

Default

ts
import { createDatasetPartHighlightComponent } from '@hungpvq/vue-map-dataset';

dataset.add(createDatasetPartHighlightComponent());
ArgumentTypeRole
dataPartial<LayerSpecification>Extra paint / layout on highlight layers
options.filterCreator(feature) => filterCustom MapLibre filter

Built-in variants

ts
createDatasetPartChangeColorHighlightComponent(data?)
createDatasetPartShadowHighlightComponent(color = '#FFB703', data?, options?)
createDatasetPartFeatureStateHighlightComponent(color = '#E63946', data?, options?)

options may include filterCreator. Feature-state also accepts stateKey.

Custom animation

ts
import { createDatasetPartCustomAnimateHighlightComponent } from '@hungpvq/vue-map-dataset';
import type { MapSimple } from '@hungpvq/map-core';

createDatasetPartCustomAnimateHighlightComponent<{ color: string; startTime: number }>(
  ({ map, layerIds, state }) => {
    map.setPaintProperty(layerIds.point, 'circle-color', state.color);
  },
  () => ({ color: '#880808', startTime: performance.now() }),
);
ArgumentRole
animateFnCalled each frame (map, layerIds, state), or null
createDefaultStateInitial animation state
dataExtra layer spec
options.layersOverride point / line / polygon highlight layers
options.layerIdsCustom layer ids
options.filterCreatorFeature filter

Map control

vue
<LayerHighlight enable-click enable-hover color="#004E98" :duration-ms="5000" />
tsx
<LayerHighlight enableClick enableHover color="#004E98" durationMs={5000} />