@gorpacrate/core-graphics
Version:
A core library for creating shape-based graphic editors
60 lines (59 loc) • 2.63 kB
TypeScript
import * as React from 'react';
import { ContextMenuRendererComponent } from '../declarations';
import { IEditorEvent } from '../editor-state/editor-events';
import { IEditorState } from '../editor-state/editor-state';
import { ButtonType } from '../editor-state/events/input';
export declare const ___ = true;
export interface IRendererPropTypes {
editorState: IEditorState;
contextMenuRenderer: ContextMenuRendererComponent;
onEditorEvent(ev: IEditorEvent): void;
}
export default class Renderer extends React.Component<IRendererPropTypes, object> {
protected rendererCanvasNode: SVGSVGElement | null;
getBoundingRect(): {
left: number;
right: number;
top: number;
bottom: number;
width: number;
height: number;
};
componentDidMount(): void;
componentWillUnmount(): void;
checkEvKey(e: React.MouseEvent<SVGElement> | React.TouchEvent<SVGElement>): void;
castMouseEvent(e: React.MouseEvent<SVGElement>): {
x: number;
y: number;
};
castMouseButtonedEvent(e: React.MouseEvent<SVGElement>): {
x: number;
y: number;
button: ButtonType;
};
castMouseButtonEvent(e: React.MouseEvent<SVGRectElement>): ButtonType;
castTouchEvent(e: React.TouchEvent<SVGElement>): {
x: number;
y: number;
};
castTouchButtonedEvent(e: React.TouchEvent<SVGElement>): {
x: number;
y: number;
button: ButtonType;
};
castTouchButtonEvent(): ButtonType;
render(): JSX.Element;
protected setRendererCanvasNode: (svg: SVGSVGElement | null) => void;
protected onCanvasMouseMove: (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
protected onCanvasMouseDown: (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
protected onCanvasMouseUp: (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
protected onCanvasMouseLeave: (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
protected onCanvasMouseEnter: (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
protected onCanvasBackgroundMouseDown: (e: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
protected onCanvasBackgroundMouseUp: (e: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
protected onCanvasTouchMove: (e: React.TouchEvent<SVGSVGElement>) => void;
protected onCanvasTouchStart: (e: React.TouchEvent<SVGSVGElement>) => void;
protected onCanvasTouchEnd: (e: React.TouchEvent<SVGSVGElement>) => void;
protected onCanvasBackgroundTouchStart: () => void;
protected onCanvasBackgroundTouchEnd: () => void;
}