vue3-openlayers icon indicating copy to clipboard operation
vue3-openlayers copied to clipboard

Added `imageLoadFunction` prop definition to `SourceImageWMS`

Open Bouhtouch opened this issue 2 years ago • 0 comments

Description

As per the official documentation ol-source-image-wms component should support an optional Function prop named imageLoadFunction. This property is supported by ol/source/ImageWMS and simply adding a definition in the Vue component fixes the issue. This fix just adds the prop definition in the SourceImageWMS component, the component's setup step already takes care of passing the defined and used props to ol/source/ImageWMS.

Motivation and Context

Without defining the supported prop under the component will prevent it from being passed to the OpenLayers module, even if it is set in the component's instance.

How Has This Been Tested?

It has been tested with the relative documentation's example setting the imageLoadFunction prop to a function that fetches the generated url adding auth headers and setting the image src with the relative base64 data. It can be tested with a simple function that just logs in console and sets the src with the given one as the default behavior.

import { ImageTile } from "ol";

function testImageLoadFunction (tile: ImageTile, src: string): void {
  //TODO log here
  tile.getImage().src = src;
}

Types of Changes

  • [x] Bug fix (non-breaking change that fixes an issue)
  • [ ] New feature (non-breaking change that adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.

Bouhtouch avatar Aug 02 '22 16:08 Bouhtouch