-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gmap-vue.js needs rebuild to include new components #44
Comments
This issue is closed because it does not meet our issue template. Please read it. |
@davydnorris I land your features, and the code works very well, please use the documentation examples to test it, if you test with the HTML examples (they will be removed soon) you need to build your own |
I have tested myself and the drawing manager html examples aren't loading the maps. I have adjusted the first one and am now trying to get the custom toolbar example to work. |
BTW I fixed the heatmap autoload - you can remove the button and change the script section to:
|
@davydnorris If you continue with this problem please can you provide more details to understand how you try to test these functionalities? |
Video 1 is technically correct but you can get the Heatmap points to autoload if you use the script above. |
@davydnorris ok, if that is the expected behaviour of the point 3, I never see it working. When I tried the HTML examples that's what I saw. Can you re-check that? |
yeah it's not working - I'm trying to fix it now |
@davydnorris I remove this line because return false and nothing was displayed on the map 🤷🏻♂️. I set it to // drawing-manager.js
// line 68
options.drawingControl = !this.$scopedSlots.default; |
So the line above checks to see whether you have provided your own custom toolbar or not by checking if there is something in the slot. The drawing manager vue file defines two functions on the slot, and you need to add v-slot="" to the outer template wrapper or component in order to access them, or explicitly get them with v-slot="{ deleteSelection, setDrawingMode }" When you do this, Vue thinks the slot is now scoped, so that's why it's checking the scoped slot variable. |
@diegoazh I found the issue - the pages are using an old release of Vuejs and slot naming is now different. This meant that the drawing manager was always dropping into the default slot, which has a class that makes it invisible. Updating to Vuejs 2.6.x fixed the slot naming and it started working. I have now fixed all examples and they work well. Please see attached I also made the drawing toolbar a little bit nicer |
@davydnorris excellent, today a will check the new examples and update Vue on the project, thanks for your efforts 👏🏽 |
I'll also do some content for the documentation around this as well. |
One thing that really trapped me, and we should definitely document, is the fact that the map component has two slots - the default slot is wrapped in a class that sets display: none; so by default any component you add to your map will be invisible. This is OK for most of the supplied components that interact directly with the Google map object, but it's not good if you want to bring up things like toolboxes etc (as I found out!!). There is a second slot named "visible" that must be used if you want to display content within the responsive wrapper for the map, hence that's why you'll see this in the second drawing manager example. It's actually not required in the first example because the default toolbox is part of the Google map object |
@davydnorris we need to change something in the |
No - it should all work fine with current as far as I know. I had to kill my git clone and pull fresh from here because the pull was messed up, so I have the current master |
We change examples and fix the drawing-manager.js adding the previously removed line 68. close: #44
* fix(documentation): change heatmap and drawing map examples We change examples and fix the drawing-manager.js adding the previously removed line 68. close: #44 * docs(documentation): add documentation for lazy loading and slots close: #44 * docs(documentation): upgrade documentation version and gmap-vue version on examples * docs(gmap-vue): upgrade gmap-vue version * test(gmap-vue): fix tests to the new api name * docs(documentation): add documentation explain how to access google maps api * chore(all): update package-lock * chore(root): add script test to travis yaml file
) * fix(documentation): change heatmap and drawing map examples We change examples and fix the drawing-manager.js adding the previously removed line 68. close: #44 * docs(documentation): add documentation for lazy loading and slots close: #44 * docs(documentation): upgrade documentation version and gmap-vue version on examples * docs(gmap-vue): upgrade gmap-vue version * test(gmap-vue): fix tests to the new api name * docs(documentation): add documentation explain how to access google maps api * chore(all): update package-lock * chore(root): add script test to travis yaml file
@davydnorris thank you so much for your efforts. I merge the changes and all is working fine, I also add more documentation and an acknowledgement for your contribution to the docs. |
* fix(gmap-vue): fix hit and drawer map components and examples (#56) (#57) * fix(documentation): change heatmap and drawing map examples We change examples and fix the drawing-manager.js adding the previously removed line 68. close: #44 * docs(documentation): add documentation for lazy loading and slots close: #44 * docs(documentation): upgrade documentation version and gmap-vue version on examples * docs(gmap-vue): upgrade gmap-vue version * test(gmap-vue): fix tests to the new api name * docs(documentation): add documentation explain how to access google maps api * chore(all): update package-lock * chore(root): add script test to travis yaml file * chore(root): add version badge to the readme (#58)
@diegoazh - thanks for merging this all in. I noticed you mentioned the toolbar isn't working - it works perfectly for me in my html example but I can't test the documentation version as I can't seem to find a working google map API key for the documentation site. Happy to help diagnose any problems with the examples in the documentation - it may also be useful to mention that in a regular application you would simply create a separate drawingToolbar.vue file and component - I had to do it like that in the example to make it one HTML file. Also I like your use of gmapPromiseLazy in the heatmap - that's really good. It may also be useful to show the computed version of the heatmap points because it's likely to be needed. There is one thing with heatmaps that catch you out - they are one of the few components where you must use the Google LatLng object. You can't use a generic object like { lat: 0, lng: 0 }. Took me a while to figure that out because Markers will accept generic objects! In practical examples you are most likely going to want to make the heatmap array reactive in some way and so it's not so simple as creating the array in the mounted() function - Vue will only pick up additions to arrays and make them reactive if you use push or a computed property, and typically your markers will be a static array of generic objects, but your heatmap weights will be dynamic and will need to be reactive, and will need to be Google LatLng objects. |
Oh and one last tiny thing - the discussion about the visible slot. This is not generic to GmapVue, it's specific to GmapMap so you may want to change the one word in that discussion so people know it's just the map component |
@davydnorris don't worry,
Thank you again. |
@diegoazh - just tried to test the examples and they aren't working because the new components aren't added to gmap-vue.js
Also the drawing manager examples aren't even loading the Google map
I also something isn't really wrong with the edits that were made to drawing-manager2.html - there is a callback slot in the drawing manager component that works the same way as the auto-complete and it's gone missing in the example, and the functions provided by the slot are being called without the slot prefix, so they do not exist
The text was updated successfully, but these errors were encountered: