简体   繁体   中英

Multiple lines label OpenLayers3

I'm trying to create multiple lines for my icon label in OL3. I need to create a four line label. I saw a question here , but there is no answer solving the problem. Does OL3 cover a solution for that now? My '\\n' are not working and I couldn't find a way to do it.

point= new ol.style.Style({
               image: new ol.style.Icon({
                    src: 'img/point.ico'

                }),
                text: new ol.style.Text({
                    font: '12px Calibri,sans-serif',
                    fill: new ol.style.Fill({ color: color }),
                    stroke: new ol.style.Stroke({
                        color: '#fff', width: 2
                    }),
                    text: "Text /n More Text /n Even More /n Last Line"
                })
            });

Thanks, any help or links are much appreciated!

No, but there is a pull request about it here . It hasn't seen any action since July, but is still open.

I'd suggest checking it out and doing a custom build with it, or contribute to the PR with testing and suggestions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM