laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
27 lines (26 loc) • 831 B
JavaScript
import { Pool } from "../../utils/Pool";
export class DrawRectCmd {
static create(x, y, width, height, fillColor, lineColor, lineWidth) {
var cmd = Pool.getItemByClass("DrawRectCmd", DrawRectCmd);
cmd.x = x;
cmd.y = y;
cmd.width = width;
cmd.height = height;
cmd.fillColor = fillColor;
cmd.lineColor = lineColor;
cmd.lineWidth = lineWidth;
return cmd;
}
recover() {
this.fillColor = null;
this.lineColor = null;
Pool.recover("DrawRectCmd", this);
}
run(context, gx, gy) {
context.drawRect(this.x + gx, this.y + gy, this.width, this.height, this.fillColor, this.lineColor, this.lineWidth);
}
get cmdID() {
return DrawRectCmd.ID;
}
}
DrawRectCmd.ID = "DrawRect";