Skip to content

Commit

Permalink
fix: improve types for getBBox
Browse files Browse the repository at this point in the history
  • Loading branch information
msand committed Oct 5, 2019
1 parent ecedb21 commit cecde7d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/elements/Shape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -256,7 +264,10 @@ export default class Shape<P> extends Component<P> {
) => {
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);
Expand Down

0 comments on commit cecde7d

Please sign in to comment.