hu de yi

Results 101 comments of hu de yi

理由: vt的style文件是个json文件,无法将js语句带入进去,如果在里面使用相对地址,如果资源目录改变了,瞬间GG 解决方法: - 手动修改json文件 - 动态请求json文件然后再代码里动态改变资源的地址 如果在style json文件里使用绝对地址,当资源地址变了也是GG,而且整个style json文件也会膨胀不少 **使用了这个方法后** 1.只要在style json文件里写个取值符合即可 ```json { symbol:{ markerFile:"$dog" } } { symbol:{ markerFile:"$images/dog" } } { symbol:{ markerFile:"$images/foo/dog" } } ```...

canvas.measureText 当大规模使用时性能比较慢,需要去探索是否有其他更好的方法来解决性能问题 经过探索发现这个库: https://github.com/deyihu/string-width 优点: 1.性能更好,大概是canvas.measuretext的四倍 2.常用的英文,数字,中文没有是么问题 目前存在的问题 1.emoji计算有问题 2.当文本里包含阿拉伯文,计算不对 3.已经提供了 hasEmoji, hasArabic 等方法,如果含有特殊字符那就可以退回到canvas.measureText ```js if (hasEmoji(text) || hasArabic(text)) { return ctx.measureText(text).width; } const len = stringWidth(text, { ambiguousIsNarrow: false...

@eLBirador The coordinates of the center point are reversed. In the maptalks system, the longitude and latitude in the coordinates are longitude before latitude after latitude. so The correct code...

@Jackyclearliu You can use some third-party libraries to solve your needs such as [turfjs](https://github.com/Turfjs/turf),[jsts](https://github.com/bjornharrtell/jsts) etc ```js const geojson=line.toGeoJSON(); const distance=turf.length(turf.linestring(geojson)) ```

https://github.com/maptalks/maptalks.js/pull/1860

close by https://mdpress.glicon.design/p/5enoiCkUaADcSh76yCKjp/releases/1_0_0_rc_34.html#%E5%8A%A0%E8%BD%BDiconfont%E5%9B%BE%E6%A0%87%E5%BA%93

the method is config ```js layer.config({....}) ```

I made a simple example, https://codepen.io/deyihu/pen/jOKaqJB?editors=0010 Because I don't fully understand your needs, I'm not sure if it's what you want @joekroese

No issues found in the current version https://codepen.io/deyihu/pen/jOogKGe