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.

37 lines (36 loc) • 1.2 kB
import CellImage from './CellImage'; import Context from './Context'; import { CellType, Fixed } from './types'; export default class BaseCell { ctx: Context; x: number; y: number; width: number; height: number; visibleWidth: number; visibleHeight: number; fixed?: Fixed; cellType: CellType; drawX: number; drawY: number; cellImages: Map<string, CellImage>; constructor(ctx: Context, x: number, y: number, width: number, height: number, cellType: CellType, fixed?: Fixed); isHorizontalVisible(): boolean; isVerticalVisible(): boolean; getDrawX(): number; getDrawY(): number; getLeftFixedX(): number; isInside(x: number, y: number): boolean; /** * 判断是否在可见区域,合并单元格用 * @param x * @param y * @returns */ isInsideVisible(x: number, y: number): boolean; setImage(key: string, image: CellImage): void; getImages(): Map<string, CellImage>; getImage(key: string): CellImage | undefined; isImageInside(key: string, e: MouseEvent): boolean; getImageClickDirection(key: string, e: MouseEvent): "up-left" | "up-right" | "down-left" | "down-right" | null; }