Code Monkey home page Code Monkey logo

Comments (3)

ghettovoice avatar ghettovoice commented on May 14, 2024

Hi!
vl-style-text has font property where you can set any available font, font size and other text style options. Value format of the font like in CSS https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font.
Example for your case with default FontAwsome stylesheet:

<vl-style-box>
  <vl-style-text font="16px FontAwesome" text="\uf041">
    <vl-style-fill color="#2355af" />
    <vl-style-stroke color="white" />
  </vl-style-text>
</vl-style-box>

from vuelayers.

francoisandre avatar francoisandre commented on May 14, 2024

Hi,

Thank you for your quick answer.
In fact when using a syntax that the one you gave me the rendering is this one:

https://i.imgur.com/tpI1cvP.png

But when I use a computed value for the text :

...
markerIcon : function() {
return '\uf041'
}

In this case this works perfectly:

https://i.imgur.com/FZKmgIH.png

My knowledge of Vue.js is too limited to see exactly the difference but I suppose that using a computed value prevent the unicode character to be interpreted as a string.

Your work is really interesting and it shows me how a real quality vue.js code should look like.

Thanks

François

from vuelayers.

ghettovoice avatar ghettovoice commented on May 14, 2024

You are right, it's Vue template compiling issue (https://vuejs.org/v2/guide/components.html#Literal-vs-Dynamic)..
In my example, the text property should be added through Vue bind syntax, then it will be handled as raw js string.

<vl-style-box>
  <vl-style-text font="16px FontAwesome" :text="'\uf041'">
    <vl-style-fill color="#2355af" />
    <vl-style-stroke color="white" />
  </vl-style-text>
</vl-style-box>

from vuelayers.

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.