From cecde7ddd3ba2c260cb6b9063075d7cdd6a64e3e Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Sat, 5 Oct 2019 16:17:55 +0300 Subject: [PATCH] fix: improve types for getBBox --- src/elements/Shape.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/elements/Shape.tsx b/src/elements/Shape.tsx index 7b0b4aa4a..8a87f419d 100644 --- a/src/elements/Shape.tsx +++ b/src/elements/Shape.tsx @@ -37,6 +37,14 @@ export interface SVGPoint extends Point { matrixTransform(matrix: SVGMatrix): SVGPoint; } +export interface Rect { + x: number; + y: number; + width: number; + height: number; +} +export interface SVGRect extends Rect {} + export interface Matrix { a: number; b: number; @@ -256,7 +264,10 @@ export default class Shape

extends Component

{ ) => { this.root && this.root.setNativeProps(props); }; - getBBox = (options?: SVGBoundingBoxOptions, callback?: () => void) => { + getBBox = ( + options?: SVGBoundingBoxOptions, + callback?: (box: SVGRect) => void, + ) => { const { fill = true, stroke = true, markers = true, clipped = true } = options || {}; const handle = findNodeHandle(this.root as Component);