📌  相关文章
📜  获取画布中的项目位置 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:18.597000             🧑  作者: Mango

代码示例1
function Rectangle(props){
  var posX = this.posX = props.x;
  var posY = this.posY = props.y;

  this.width = props.width;
  this.height = props.height;
  this.fill = props.fill;

  this.draw = function(){
    ctx.fillStyle = this.fill;
    ctx.fillRect(this.posX, this.posY, this.width, this.height);
  }
}