您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

base-shape.tsx 703B

12345678910111213141516171819
  1. import { Bounds, Shape } from "types"
  2. export default interface ShapeUtil<K extends Shape> {
  3. create(props: Partial<K>): K
  4. getBounds(this: ShapeUtil<K>, shape: K): Bounds
  5. hitTest(this: ShapeUtil<K>, shape: K, test: number[]): boolean
  6. hitTestBounds(this: ShapeUtil<K>, shape: K, bounds: Bounds): boolean
  7. rotate(this: ShapeUtil<K>, shape: K): K
  8. translate(this: ShapeUtil<K>, shape: K, delta: number[]): K
  9. scale(this: ShapeUtil<K>, shape: K, scale: number): K
  10. stretch(this: ShapeUtil<K>, shape: K, scaleX: number, scaleY: number): K
  11. render(this: ShapeUtil<K>, shape: K): JSX.Element
  12. }
  13. export function createShape<T extends Shape>(
  14. shape: ShapeUtil<T>
  15. ): ShapeUtil<T> {
  16. return shape
  17. }