Skip to content

Commit

Permalink
feat(ol-vector-tile-layers): add support for renderMode property
Browse files Browse the repository at this point in the history
closes #263
  • Loading branch information
d-koppenhagen committed Oct 26, 2023
1 parent e8280e1 commit 116b576
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/componentsguide/layers/vectortilelayer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,13 @@ The maximum view zoom level (inclusive) at which this layer will be visible.
- **Type**: `number`
- **Default**: `0`
Low-resolution tiles up to preload level will be load.

### renderMode

- **Type**: `'hybrid' | 'vector'`
- **Default**: `hybrid`

Render mode for vector tiles.

- `hybrid`: Polygon and line elements are rendered as images, so pixels are scaled during zoom animations. Point symbols and texts are accurately rendered as vectors and can stay upright on rotated views.
- `vector`: Everything is rendered as vectors. Use this mode for improved performance on vector tile layers with only a few rendered features (e.g. for highlighting a subset of features of another layer with the same source).
6 changes: 5 additions & 1 deletion src/components/layers/OlVectorTileLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

<script setup lang="ts">
import { inject, provide, onUnmounted, onMounted, watch, computed } from "vue";
import VectorTileLayer from "ol/layer/VectorTile";
import VectorTileLayer, {
type VectorTileRenderType,
} from "ol/layer/VectorTile";
import type Map from "ol/Map";
import usePropsAsObjectProperties from "@/composables/usePropsAsObjectProperties";
import {
Expand All @@ -24,13 +26,15 @@ const props = withDefaults(
updateWhileAnimating?: boolean;
styles?: StyleLike | FlatStyleLike | null;
updateWhileInteracting?: boolean;
renderMode?: VectorTileRenderType;
}
>(),
{
...layersCommonDefaultProps,
renderBuffer: 100,
updateWhileAnimating: false,
updateWhileInteracting: false,
renderMode: "hybrid",
},
);
Expand Down

0 comments on commit 116b576

Please # to comment.