Skip to content
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

[WIP] [Next version] #29

Closed
wants to merge 79 commits into from
Closed

[WIP] [Next version] #29

wants to merge 79 commits into from

Conversation

dagatsoin
Copy link

@dagatsoin dagatsoin commented Apr 11, 2016

ANDROID ONLY FOR THE MOMENT

I have refactored the code (inspired by Google Maps cordova plugin) to be able to display the map behind the webview. So:

  • dom element can be displayed on top of it
  • map scrolls with the webview

Futur development.

  • track overlay elements.
  • to be able to click on DOM overlay elements.

The Mapbox SDK is now iOS 3.2.0 and also fixes a memory leak which add 30-50mo each time the user show/hide the map.
Note the memory usage is now 130mo. But considering that the old SDK leak led to more than 130mo after 5 show/hide, it is not a big deal.

@dagatsoin dagatsoin changed the title [WIP]Feature/place view behind [WIP] display map view behind webview Apr 11, 2016
@dagatsoin
Copy link
Author

@EddyVerbruggen I think I am done for the iOS part of this feature. If you want to test it I modified the index.html with new buttons.

New:

/**
 * Toggle touch events on the map. For exemple if a modal is over the map when opening
 * you should use this to disable touch event on the map.
 * @param options:{clickable:boolean}
*/
  setClickable(options, successCallback, errorCallback, id)

/**
 * Call this function when the map is resized or when a DOM element is added inside the map div.
 * It will recompute the clickable layout.
 * @param options:{divId:string}
*/
  refreshMap(options, successCallback, errorCallback, id)

Update:

  • a map could be initialise by passing a div id. All children elements of this div will be clickable without transmit touch event on the map.

show({div:String}, successCallback, errorCallback, id)

@dagatsoin
Copy link
Author

Any help on converting this on Java will be appreciated :) (cc @beachygreg)
Next step will be implements offline maps or fuse #22 at some point.

@beachygreg
Copy link

Happy to help out where I can but how does this merge request relate to #22 ?

@dagatsoin
Copy link
Author

dagatsoin commented May 1, 2016

@beachygreg
Both PR have same final goals:

  • last MB native api
  • offline maps
  • multimaps

On top of this @tnightingale works on more advanced JS api to stick to his needs and MapboxJS. On my part I want to make a smooth transition from the current cordova plugin API without introduce breaking changes.

I also got inspired from the google map cordova plugin to be able to put overlay dom elements like search bars, navigation, etc... but also advanced markers (DOM element) which is not possible with MapboxGL.

I still have to:

  • expose the api part for the Offline Map features
  • making overlay elements work with mutlimaps

After that, if it is possible I will stick to @tnightingale JS api.

@beachygreg
Copy link

@dagatsoin cool, I am really after the offline maps. I am a java developer and have done some android programming before so should be able to help out. Only thing is I don't have that much time but sure I can help. Will checkout your branch and take a look.

@dagatsoin
Copy link
Author

dagatsoin commented May 1, 2016

@beachygreg If you can't wait for offline map, maybe you should first give a try to @tnightingale PR. But if you want to dive in code, you are welcome :)
I have not commented my code. Here is how it works:

  • CDVMapBox.h: retrieve the CDV command, use MapManager to give the right map (in case of multipmap)
  • MapsManager.h: a singleton which stores the maps (in case of multimaps). It does not content logic, juste set, get, remove a specific map in a collection.
  • Map.h: the concrete Map object. Receive the CDV command and communicate to the controller.
  • MapController.h: it is the mapbox controller, expose the Mapbox API and handle the GLView. It is the classical file use in MapboxGL app.
  • PluginLayer.h: "dig a hole" in the web view and place the map behind so that the touch event in the map zone passes through the webview. The cool part, is that you can add DOM elements on top of the map (which is not possible with the actual version of cordova mapbox plugin) enabling advanced markers as vidéo, game assets, gl canvas, etc. The main role of this file is to intercept the touch event. If event hits a DOM overlay element (Marker, searchBar, ...) it will be send to the webview (scroll, tap, etc.). If not, it transmit the event to the MapboxGL view (drag, pan, rotate, ect...)
  • Scrollview.h: attach the MapboxGL view to the webview so it follows scroll and transition.

If you want more detail, fill free to ask.

@yipcma
Copy link

yipcma commented Sep 7, 2017

I'd definitely love to have it bind to an html element, this facilitates cross-platform deployment without worrying about the pixels. Hopefully, overlay can be done automatically as well.

@dagatsoin dagatsoin mentioned this pull request Nov 10, 2017
@ansarikhurshid786
Copy link

3d support status please

@dagatsoin
Copy link
Author

This PR is not maintained anymore. Due to the heavy changes, I switch to my own repo: https://github.com/dagatsoin/cordova-plugin-mapbox I will post the doc soon.
Demo for early birds here: https://github.com/dagatsoin/cordova-plugin-mapbox-demo

@dagatsoin dagatsoin closed this Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.