Coder Social home page Coder Social logo

RTL text not supported about vue-mapbox-gl HOT 6 CLOSED

phegman avatar phegman commented on June 9, 2024
RTL text not supported

from vue-mapbox-gl.

Comments (6)

abdelhameedhamdy avatar abdelhameedhamdy commented on June 9, 2024 2

I am having an issue with setRTLTextPlugin
When navigating between pages and return back to map, I got the following error :
Error: setRTLTextPlugin cannot be called multiple times.

from vue-mapbox-gl.

phegman avatar phegman commented on June 9, 2024

Yes you should be able to do this in the @map-init event like so:

<mapbox
  access-token="your access token"
  :map-options="{
      style: 'mapbox://styles/mapbox/light-v9',
      center: [-96, 37.8],
      zoom: 3
  }"
  :geolocate-control="{
      show: true,
      position: 'top-left'
  }"
  :scale-control="{
      show: true,
      position: 'top-left'
  }"
  :fullscreen-control="{
      show: true,
      position: 'top-left'
  }"
  @map-init="mapInitialized">
</mapbox>
import Mapbox from 'mapbox-gl-vue';
const app = new Vue({
  el: '#app',
  components: { Mapbox },
  methods: {
    mapInitialized(map) {
      map.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
    }
  }
});

I haven't personally tested but according to the documentation this seems like the logical thing to try. Give that a shot and see if it works!

from vue-mapbox-gl.

abdelhameedhamdy avatar abdelhameedhamdy commented on June 9, 2024

Hi I tested it, it does not work

mapInitialized(map) {
map.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
}
It gives the following error :
TypeError: map.setRTLTextPlugin is not a function
at VueComponent.mapInitialized (map.f834d33b7d830e239136.hot-update.js:53)

But, when trying it as :
mapInitialized() {
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
}

It works..

from vue-mapbox-gl.

mhsattarian avatar mhsattarian commented on June 9, 2024

Hi @abdelhameedhamdy,
I tried what you said and it didn't worked for me. can you guess what may be wrong?

from vue-mapbox-gl.

BJTheCod3r avatar BJTheCod3r commented on June 9, 2024

This is closed but might help somebody looking into this now;

Do something like this

mapInitialized() {
    if (window.mapboxgl.getRTLTextPluginStatus() != "loaded") {
        window.mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js')
    }
}

from vue-mapbox-gl.

eladcandroid avatar eladcandroid commented on June 9, 2024

@abdelhameedhamdy
Did you succeed in enabling it?

from vue-mapbox-gl.

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.