首页 > 解决方案 > 有没有办法避免在 Pixi.js 中的同一位置绘制多个点?

问题描述

你知道是否有办法检查我在 pixi.js 中绘制图形的位置是否已经有另一个图形?

如果可能的话,我想做类似下面的事情。

const graphic = new PIXI.Graphics();
graphic.x = coords[0]
graphic.y = coords[1]

if (graphic.isExists) {
   console.log("graphic already exists on the same location")
   return
}else {
   app.stage.addChild(graphic)
}

如果有办法做与上述类似的事情,您的建议将不胜感激。

标签: javascriptcanvaspixi.js

解决方案


推荐阅读