parent
847207fa64
commit
2ed77cd4dc
@ -0,0 +1,21 @@
|
|||||||
|
import { DeepRequired } from '../../../interface/Common'
|
||||||
|
import { IEditorOption } from '../../../interface/Editor'
|
||||||
|
import { IRowElement } from '../../../interface/Row'
|
||||||
|
import { Draw } from '../Draw'
|
||||||
|
|
||||||
|
export class CheckboxParticle {
|
||||||
|
|
||||||
|
private options: DeepRequired<IEditorOption>
|
||||||
|
|
||||||
|
constructor(draw: Draw) {
|
||||||
|
this.options = draw.getOptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number) {
|
||||||
|
const { checkbox: { gap } } = this.options
|
||||||
|
const { metrics } = element
|
||||||
|
ctx.rect(x + gap, y - metrics.height, metrics.width - gap * 2, metrics.height)
|
||||||
|
ctx.stroke()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { ICheckboxOption } from '../../interface/Checkbox'
|
||||||
|
|
||||||
|
export const defaultCheckboxOption: Readonly<Required<ICheckboxOption>> = {
|
||||||
|
width: 14,
|
||||||
|
height: 14,
|
||||||
|
gap: 5
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
export interface ICheckbox {
|
||||||
|
disabled?: boolean;
|
||||||
|
value: boolean | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICheckboxOption {
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
gap?: number;
|
||||||
|
}
|
||||||
Loading…
Reference in new issue