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 use it with Angular 6+ #21

Closed
dashtaki opened this issue May 31, 2019 · 4 comments
Closed

How to use it with Angular 6+ #21

dashtaki opened this issue May 31, 2019 · 4 comments

Comments

@dashtaki
Copy link

No description provided.

@ryanhamley
Copy link
Contributor

Can you provide some information on what issue you're seeing using this with Angular 6+?

@dashtaki
Copy link
Author

dashtaki commented May 31, 2019

This is one of my layer and I want to use it rtlText.processBidirectionalText(text, []) in text-field property:

 {
          'id': 'titles',
          'type': 'symbol',
          'source': 'G_Rahro_source',
          'zoom': 0.0,
          'center': [0.000000, 0.000000],
          'layout': {
            'text-rotate': ['to-number', ['get', 'ROTATION']],
            'text-field': {type: 'identity', property: 'TITLE1'},
            'text-size': ['to-number', ['get', 'FONT_SIZE']],
            'text-font': ['IRANSansWebFaNum Regular']
          },
          'paint': {
            'text-color': {type: 'identity', property: 'FONT_COLOR'}
          },
        },

Could you explain how to use it in Angular project. I got stock in for a while. I have to get text-field value from .geojson file and because it is in Persian I have to make it as bidirectional.
map

@ryanhamley
Copy link
Contributor

You shouldn't need to call processBidirectionalText directly in a function like that if you're just trying to make text render RTL. You just need to include the plugin as in this example https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/

I don't know specifics of newer Angular implementations to offer many pointers there. You might have better luck asking on Stack Overflow which is where we generally refer "how to" questions like this. But if there's something you're doing differently in your setup that's causing problems and you can replicate that outside of Angular, I'd be happy to take a look if you can reply to this thread with a JSBin or something similar.

@dashtaki
Copy link
Author

dashtaki commented Jun 1, 2019

Thanks so much for your help finally I could do that perfectly. I forgot to import it in component:

import * as mapBoxGl from 'mapbox-gl';

And then:

mapBoxGl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js', () => {});
Thanks again @ryanhamley

@dashtaki dashtaki closed this as completed Jun 1, 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

No branches or pull requests

2 participants