davidpiesse / nova-map

Laravel Nova Map Field
114 stars 29 forks source link

Major Upgrade! vue2-leaflet@v2 #22

Closed neyaoz closed 3 years ago

neyaoz commented 4 years ago

Upgrade npm packages. by the way, vue2-leaflet is already 1 year old. [v2.0.0(https://github.com/vue-leaflet/Vue2Leaflet/releases/tag/v2.0.0)

Add peer dependencies as dependencies. https://github.com/vue-leaflet/Vue2Leaflet#leaflet-is-not-automatically-installed-anymore

Fixes fitBounds() - Error: Bounds are not valid error when another Nova tool uses vue2-leaflet v2.

davidpiesse commented 4 years ago

Thanks,

I will have a look at this and test it out :)

pelmered commented 3 years ago

@davidpiesse Can you try to merge this? I've been having this issue for a while.

pelmered commented 3 years ago

@davidpiesse Thanks a lot for for the quick merge! Maybe it was too quick.

The error is gone, but the field is now blank like this: Screenshot 2020-10-29 at 18 53 13

My code:


            Map::make('Current Location', function () {
                $location = $this->resource->getPosition();
                if ($location) {
                    return new Point($location['lat'], $location['lng']);
                }
                return null;
            })
               ->hideFromIndex()
               ->hideWhenCreating()
               ->spatialType('Point'),

It's not returning null. That if clause is just to avoid errors just after creation before the coordinates are set.

davidpiesse commented 3 years ago

Are there any errors in the console? It may be that the compile/ build has not been successful.

pelmered commented 3 years ago

@davidpiesse No, no other errors. I also tried rebuilding the assets in a fork, but that didn't help. https://github.com/heap-carsharing/nova-map

pelmered commented 3 years ago

@davidpiesse If you have problems reproducing this, please tell me where I should look or what additional information you think you would need.

davidpiesse commented 3 years ago

My Dev env is kicking up a shit storm (npm and yarn). I have not yet been able to rebuild it on the current master.. Have you tried using your fork and seeing if it works still?