Giter Site home page Giter Site logo

Comments (14)

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

You can not put any images or buttons over the map, because the map places above the web view (HTML layer). I have been considering this feature request, but not find any better way.

from cordova-plugin-googlemaps.

jskidd3 avatar jskidd3 commented on May 13, 2024

@wf9a5m75 Could you please try and find a way to do this? I think it's a common feature that will be requested by many users. For example, in my application I need to be able to add a custom control that functions in its own way.

With the Google Maps JavaScript API I could do this simply by creating an absolute element, positioning it above the map canvas, and then adding an event handler to the element.

I think this is something that needs to be possible in the plugin, or at least a way to add custom controls.

I have a sidebar in my application and when I try to move the map-canvas div that the map is in it just stays still. Is there a way to get around this? If I want to move the map-canvas div around do I have to call setDiv() every single time? If this is the case it means that no movement can be animated in terms of moving the map around the page as you have to call the method every time.

Without this sort of functionality every app that uses the plugin is restricted to a single screen. Really we need the application to sit inside of the div so it can be moved around like you would expect.

from cordova-plugin-googlemaps.

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

@jskidd3
Execute map.refreshLayout() after moving the map-canvas div.

from cordova-plugin-googlemaps.

jjhuff avatar jjhuff commented on May 13, 2024

I'd like to see something similar. Ideally, I want a marker always positioned in the center of the map (i.e. what the Uber app does). Right now, I move the marker when the camera moves, but it feels odd since the marker doesn't move while the map is dragging.

What about doing something like:
http://stackoverflow.com/questions/8098874/how-to-display-fixed-postion-overlay-in-mapview

Thanks!

from cordova-plugin-googlemaps.

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

This is implemented in v1.2.0. V1.2.0 is going to release in September.

from cordova-plugin-googlemaps.

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

Please try the new version of the plugin.
This problem should be fixed. (I tested many times)
https://plus.google.com/112861993350247152906/posts/ber5LChbWkU

from cordova-plugin-googlemaps.

gchokeen avatar gchokeen commented on May 13, 2024

Is this documented, I am using plugin v1.2.5, but I unable to find how to implement this?

from cordova-plugin-googlemaps.

rayanwipes avatar rayanwipes commented on May 13, 2024

Hey !
Is there a new way as of now to keep a marker fixed to the center of the map ?
Thank you,

from cordova-plugin-googlemaps.

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

Using the plugin v2, you should be able to do with this:

map.on(plugin.google.maps.event.CAMERA_MOVE, function(cameraPosition) {
  marker.setPosition(cameraPosition.target);
});

from cordova-plugin-googlemaps.

rayanwipes avatar rayanwipes commented on May 13, 2024

Hey Masashi,
Thank you for your answer. This is how I do it now; however, there's a slight delay between the map moving and the marker staying in the center. This is what I'm looking to correct...

from cordova-plugin-googlemaps.

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

Or put an image in the map div.

<div id="map" style="position: relative">
    <img src="marker.img" style="position: absolute; left:50%;top:50%;" />
</div>

from cordova-plugin-googlemaps.

rayanwipes avatar rayanwipes commented on May 13, 2024

Hello Masahi,

I have used your fix and it has been working perfectly. However, multiple users have alerted me about a problem. When elements are overlayed on top of the map, dragging those elements causes the map to scroll.

The detail of the bug can be found here :
https://forum.ionicframework.com/t/elements-on-top-of-google-map-scroll-bug/114692

Would anyone know if there's a way to prevent that from happening ?

Thank you very much.

from cordova-plugin-googlemaps.

wf9a5m75 avatar wf9a5m75 commented on May 13, 2024

How about this?

<div id="map" style="position: relative">
    <img id="centerMarker" src="marker.img" style="position: absolute; left:50%;top:50%;" />
</div>
var centerMarker = document.getElementById("centerMarker");
centerMarker.addEventListener("touchstart", function(e) {
  e.preventDefault();
});

from cordova-plugin-googlemaps.

Muralilive avatar Muralilive commented on May 13, 2024

Drag map while keeping marker at the center

from cordova-plugin-googlemaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.