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

How to add clickable buttons over the native map via the property additionalDomElements? #1

Closed
LucaTrip opened this issue Sep 9, 2019 · 2 comments

Comments

@LucaTrip
Copy link

LucaTrip commented Sep 9, 2019

Hi, i'm tying to add clickable buttons over the native map but with poor results.
My implementation is:

`ionViewDidLoad() {

Mapbox.show({
  domContainer: this.nativeMap.nativeElement,
  additionalDomElements: [this.overlay.nativeElement.children[0], this.overlay.nativeElement.children[1]],
  style: 'satellite',
  cameraPosition: {
    target: {
      lat: 43.1122, 
      lng: 12.38878
    }
  },
  sources: [],
  hideAttribution: true,
  hideLogo: true,
  hideCompass: true,
  disableRotation: false,
  disableScroll: false,
  disableTilt: true,
  disableZoom: false,
  disablePitch: false
}, result => {
  console.log("succ to show map", result, Mapbox);
}, error => {
  console.log("error to show native map ", error);
});

}`

The two simple buttons are rendered but when i touch them, the click goes through moving the map.

What am I doing wrong?

I'm tying this plugin in a starter ionic v3 app:

Ionic:
Ionic CLI : 5.2.1 (/Users/me/.nvm/versions/node/v8.16.0/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.5
@ionic/app-scripts : 3.2.2

Cordova:
Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 8.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 5 other plugins)

Utility:
cordova-res : not installed
native-run : 0.2.7 (update available: 0.2.8)

System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v8.16.0 (/Users/me/.nvm/versions/node/v8.16.0/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.3 Build version 10G8

@dagatsoin
Copy link
Owner

Hello,

first attempt: are you sure that the container and the overlay element size are known when they are passing to show() ?

@LucaTrip
Copy link
Author

Thanks for the reply. I wrapped the show method in setTimeout and it works.

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

No branches or pull requests

2 participants