Closed HMubaireek closed 4 years ago
I would also like to use plugins, namely mapbox-gl-draw. As far as I can tell it would be enough for me to be able to write my own control directive, but that is not an option right now as MapService and ControlComponent are not exposed in the library.
I have the drawing tools working with this project.
I accomplished it by doing the following:
Load the css in angular.json
"styles": [
"src/styles.scss",
"node_modules/mapbox-gl/dist/mapbox-gl.css",
"node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css"
]
Import the drawing module into your component;
import * as MapboxDraw from '@mapbox/mapbox-gl-draw';
On load, add the control to your map;
@ViewChild('map') map;
ngAfterViewInit() {
const draw = new MapboxDraw();
this.map.load.pipe(take(1)).subscribe(() => {
this.map.MapService.addControl(draw, 'top-right');
});
}
I think it would be good if the created exposed ControlComponent
to the public API. This would allow creation of custom directives, like Draw.
Here is a PR with that I think is a more elegant solution and would allow community based plugins.
after installing mapbox-gl-rtl-text
following errors occured:
**ERROR in ./node_modules/@mapbox/mapbox-gl-rtl-text/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\My Data\Angular\BehzistiSearch\node_modules\@mapbox\mapbox-gl-rtl-text'
ERROR in ./node_modules/@mapbox/mapbox-gl-rtl-text/index.js
Module not found: Error: Can't resolve 'path' in 'C:\My Data\Angular\BehzistiSearch\node_modules\@mapbox\mapbox-gl-rtl-text'**
I would also like to use plugins, namely mapbox-gl-draw. As far as I can tell it would be enough for me to be able to write my own control directive, but that is not an option right now as MapService and ControlComponent are not exposed in the library.
It would be awesome to use mapbox draw
As far as i understand this was solved by #79 and should be available to do with the latests version of the library (4.8.1). Thus, i'm closing this issue. If someone thinks there's still work to do - please chime in and we'll figure it out.
@amirofy2002 mentioned above error when the mapbox-gl-rtl-text connected with addControl method. The error is still there. It seems that mapbox-gl-rtl-text differs from another plugins.
Does anyone has an idea how to connect mapbox-gl-rtl-text to a project?
@ArmaProjects This issue is closed. Please create a new one and provide a reproduction project (preferrably, using the stackblitz template supplied). Then, if someone has time, they may help you.
Hi,
I've been looking to find a way to use mapbox plugins, specifically mapbox-gl-rtl-text.
I've been thinking we could use it in NgxMapboxGLModule.withConfig but that is not supported.
What is the way to do it?