melowntech / vts-browser-js

JavaScript WebGL 3D map rendering engine
BSD 2-Clause "Simplified" License
220 stars 42 forks source link

Easy way to generate labels onCustomRender? #192

Closed jrjdavidson closed 4 years ago

jrjdavidson commented 4 years ago

Is there a simple way to render labels using dynamic rendering (onCustomRender)? The gpx viewer adds a control and positions it on custom render, but this method seems quite convoluted. Especially as I'm hoping to have the users add points dynamically to the map.

davidmtech commented 4 years ago

Currently only option is to use HTML text. There is example (you have to hover over line):

https://jsfiddle.net/yLduqhL8/

another option is to use debug text function (no as fancy as HTML but sometime is good enough):

renderer.drawDebugText(options)

supported options are: text : "string" coords: [screenX, screenY] color: [r,g,b,a] size : numer depth : number useState : bool

there is example: https://www.melowntech.com/mercury/?pos=obj,-100.782187,48.617979,fix,-1382.64,-156.38,-90.00,0.00,3020166.57,55.00

there is example source code: https://cdn.melown.com/static/web/homepage-web-static/mercury/main.js?2.37

jrjdavidson commented 4 years ago

renderer.drawDebugText() is exactly what I was after, thanks.