|
| 1 | +# ol-source-tile-debug |
| 2 | + |
| 3 | +A pseudo tile source, which does not fetch tiles from a server, but renders a grid outline for the tile grid/projection along with the coordinates for each tile. |
| 4 | +See examples/canvas-tiles for an example. |
| 5 | + |
| 6 | +<script setup> |
| 7 | +import TileDebugDemo from "@demos/TileDebugDemo.vue" |
| 8 | +import ProjectionRegisterDemo from "@demos/ProjectionRegisterDemo.vue" |
| 9 | +</script> |
| 10 | + |
| 11 | +<ClientOnly> |
| 12 | +<ProjectionRegisterDemo /> |
| 13 | +<hr /> |
| 14 | +<TileDebugDemo /> |
| 15 | +</ClientOnly> |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +::: code-group |
| 20 | + |
| 21 | +<<< ../../../../src/demos/TileDebugDemo.vue |
| 22 | + |
| 23 | +::: |
| 24 | + |
| 25 | +## Properties |
| 26 | + |
| 27 | +### Props from OpenLayers |
| 28 | + |
| 29 | +Properties are passed-trough from OpenLayers directly. |
| 30 | +Their types and default values can be checked-out [in the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_TileDebug-TileDebug.html). |
| 31 | +Only some properties deviate caused by reserved keywords from Vue / HTML. |
| 32 | +This deviating props are described in the section below. |
| 33 | + |
| 34 | +### Deviating Properties |
| 35 | + |
| 36 | +None. |
| 37 | + |
| 38 | +## Events |
| 39 | + |
| 40 | +You have access to all Events from the underlying source. |
| 41 | +Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_TileDebug-TileDebug.html) to see the available events tht will be fired. |
| 42 | + |
| 43 | +```html |
| 44 | +<ol-source-tile-debug @error="handleEvent" /> |
| 45 | +``` |
| 46 | + |
| 47 | +## Methods |
| 48 | + |
| 49 | +You have access to all Methods from the underlying source. |
| 50 | +Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_source_TileDebug-TileDebug.html) to see the available methods. |
| 51 | + |
| 52 | +To access the source, you can use a `ref()` as shown below: |
| 53 | + |
| 54 | +```vue |
| 55 | +<template> |
| 56 | + <!-- ... --> |
| 57 | + <ol-source-tile-debug ref="sourceRef" /> |
| 58 | + <!-- ... --> |
| 59 | +</template> |
| 60 | +
|
| 61 | +<script setup lang="ts"> |
| 62 | +import { ref, onMounted } from "vue"; |
| 63 | +import type TileDebug from "ol/source/TileDebug"; |
| 64 | +
|
| 65 | +const sourceRef = ref<{ source: TileDebug }>(null); |
| 66 | +
|
| 67 | +onMounted(() => { |
| 68 | + const source: TileDebug = sourceRef.value?.source; |
| 69 | + // call your method on `source` |
| 70 | +}); |
| 71 | +</script> |
| 72 | +``` |
0 commit comments