Mercurial > gemma
changeset 1926:1220cfe96efd
client: prepare isoline legend graphic for reuse
* Change loading of the legend image for the isolines to directly
convert it into a dataUrl, so it can be re-used later. Doing it
here as, this is the place where asynchronous loading is taking place.
* License header: Add BER as author and 2019.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 21 Jan 2019 10:41:46 +0100 |
parents | 9b5993a0551f |
children | 5a37ee321651 |
files | client/src/components/layers/Layerselect.vue |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/layers/Layerselect.vue Mon Jan 21 10:25:45 2019 +0100 +++ b/client/src/components/layers/Layerselect.vue Mon Jan 21 10:41:46 2019 +0100 @@ -38,12 +38,13 @@ * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt * - * Copyright (C) 2018 by via donau + * Copyright (C) 2018, 2019 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH * * Author(s): - * Thomas Junk <thomas.junk@intevation.de> + * * Thomas Junk <thomas.junk@intevation.de> + * * Bernhard Reiter <bernhard.reiter@intevation.de> */ import { HTTP } from "@/lib/http"; export default { @@ -64,6 +65,7 @@ }, created() { // fetch legend image for bottleneck isolines + // directly read as dataURL so it is reusable later // TODO: move to store if (this.layername == "Bottleneck isolines") { const src = @@ -75,8 +77,12 @@ }, responseType: "blob" }).then(response => { - var urlCreator = window.URL || window.webkitURL; - this.isolinesLegendImgUrl = urlCreator.createObjectURL(response.data); + var that = this; + const reader = new FileReader(); + reader.onload = function() { + that.isolinesLegendImgUrl = this.result; + }; + reader.readAsDataURL(response.data); }); } }