UNPKG

e-virt-table

Version:

A powerful data table based on canvas. You can use it as data grid、Microsoft Excel or Google sheets. It supports virtual scroll、cell edit etc.

72 lines • 2.07 kB
export default class CellImage { constructor(name, x, y, width, height, source) { Object.defineProperty(this, "source", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "x", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "y", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "width", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "height", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "visible", { enumerable: true, configurable: true, writable: true, value: true }); this.source = source; this.name = name; this.x = x; this.y = y; this.width = width; this.height = height; } drawWrapper(ctx, options) { ctx.paint.drawRect(this.x - 2, this.y - 2, this.width + 4, this.height + 4, { radius: 4, borderWidth: 1, ...options, }); } setVisible(visible) { this.visible = visible; } isInside(mouseX, mouseY) { if (!this.visible) { return false; } if (this.source && mouseX > this.x && mouseX < this.x + this.width && mouseY > this.y && mouseY < this.y + this.height) { return true; } return false; } } //# sourceMappingURL=CellImage.js.map