ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
682 stars 230 forks source link

Using Reg-Shape #451

Closed scadergit closed 2 years ago

scadergit commented 2 years ago

Can't seem to resolve how to properly use reg-shape. Created this fiddle based on another example you provided. When switched vl-style-circle to vl-style-reg-shape, and adding "points" attribute, it simply doesn't render the features instead of triangles.

https://jsfiddle.net/ghettovoice/z6huwdcs/

I get the following error...

vue.esm.js:629 [Vue warn]: Error in mounted hook (Promise/async): "TypeError: Cannot set property 'opacity_' of undefined"

found in

---> <VlStyleRegShape> at style.vue
       <VlStyleBox> at style.vue
         <VlSourceVector> at source.vue
           <VlLayerVector> at layer.vue
             <VlLayerGroup> at layer.vue
               <AppLocalRadar> at src/components/map/LocalRadar.vue
                 <VlMap> at map.vue
                   <CmiMap> at src/cmi/components/Map.vue
                     <AppMap> at src/components/Map.vue
                       <App> at src/components/App.vue
                         <Root> 

where "opacity_" is a property of the OL ImageStyle "this" instance...

var ImageStyle = function ImageStyle(options) {

  /**
   * @private
   * @type {number}
   */
  this.opacity_ = options.opacity;
scadergit commented 2 years ago

I found the issue, missing new keyword

      return RegularShape({

https://github.com/ghettovoice/vuelayers/blob/v0.11.36/src/component/reg-shape-style/style.vue#L36

Am I really the first to use reg-shape directly? 🤔

ghettovoice commented 2 years ago

Thanks for report 👍

Am I really the first to use reg-shape directly?

I guess it is used rarely