KineticJS - 获取路径形状的宽度/高度? [英] KineticJS - Get the width/height of a Path Shape?
本文介绍了KineticJS - 获取路径形状的宽度/高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这对我来说是一个大问题...
this is a big issue for me at the moment...
我通过路径形状渲染世界地图...问题是路径形状不提供宽度或高度,
,所以缓存或其他简单的操作变得很难做。
I'm rendering a world map via Path shapes... problem is the Path Shape does not offer width or height, so caching or other simple operations become really hard to do.
例如我给予 path.toImage
?
任何想法如何解决这个问题?
Any idea how I could get around this problem?
推荐答案
如果世界地图路径由一个系列(通常是),你可以通过查找路径数据中的minX / minY和maxX / maxY坐标来获得路径的边界框。
If the world map path is made up of a series of lines (as it often is), you can get the bounding box of the path by looking for the minX/minY and maxX/maxY coordinates in your path data.
这篇关于KineticJS - 获取路径形状的宽度/高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文