From 42614ff7975b570739cf81da3f07fecad532e9c5 Mon Sep 17 00:00:00 2001 From: Vladimir Vershinin Date: Thu, 3 Oct 2019 18:03:51 +0300 Subject: [PATCH] Allow return single Style instance from style function --- package-lock.json | 5 - src/component/style-func/style.vue | 205 ++++++++++++++--------------- src/mixin/styles-container.js | 4 +- test/app.vue | 11 +- 4 files changed, 112 insertions(+), 113 deletions(-) diff --git a/package-lock.json b/package-lock.json index be0be5ed..9bb0d17d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19599,11 +19599,6 @@ "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", "dev": true }, - "whatwg-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", - "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" - }, "which": { "version": "1.2.14", "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", diff --git a/src/component/style-func/style.vue b/src/component/style-func/style.vue index c0b04586..f683209b 100644 --- a/src/component/style-func/style.vue +++ b/src/component/style-func/style.vue @@ -1,4 +1,5 @@ diff --git a/src/mixin/styles-container.js b/src/mixin/styles-container.js index ea18318e..149c3299 100644 --- a/src/mixin/styles-container.js +++ b/src/mixin/styles-container.js @@ -1,4 +1,5 @@ import Vue from 'vue' +import { Style } from 'ol/style' import { warn } from '../util/log' import { isFunction, reduce } from '../util/minilo' @@ -149,7 +150,8 @@ export default { // not empty or null style if ( styles === null || - (Array.isArray(styles) && styles.length) + (Array.isArray(styles) && styles.length) || + styles instanceof Style ) { return styles } diff --git a/test/app.vue b/test/app.vue index 05d571ef..6d78a76b 100644 --- a/test/app.vue +++ b/test/app.vue @@ -19,6 +19,7 @@ + @@ -33,7 +34,7 @@