Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
applicationActions: bindActionCreators(applicationActions, dispatch),
};
}
/**
* @name - Editor Page
* @description - Page for adding/editing/removing tags to assets
*/
@connect(mapStateToProps, mapDispatchToProps)
export default class EditorPage extends React.Component {
public state: IEditorPageState = {
project: this.props.project,
selectedTag: null,
lockedTags: [],
selectionMode: SelectionMode.RECT,
assets: [],
childAssets: [],
editorMode: EditorMode.Rectangle,
additionalSettings: { videoSettings: (this.props.project) ? this.props.project.videoSettings : null },
thumbnailSize: this.props.appSettings.thumbnailSize || { width: 175, height: 155 },
isValid: true,
showInvalidRegionWarning: false,
};
private loadingProjectAssets: boolean = false;
private toolbarItems: IToolbarItemRegistration[] = ToolbarItemFactory.getToolbarItems();
private canvas: RefObject<canvas> = React.createRef();
public async componentDidMount() {
const projectId = this.props.match.params["projectId"];
if (this.props.project) {</canvas>
public static createTestCanvas(project: IProject = null) {
const canvasProps: ICanvasProps = {
project,
selectedAsset: this.createTestAssetMetadata(this.createTestAsset("test-asset")),
onAssetMetadataChanged: jest.fn(),
editorMode: EditorMode.Rectangle,
selectionMode: SelectionMode.RECT,
children: null,
lockedTags: [],
};
return new Canvas(canvasProps);
}
private onToolbarItemSelected = async (toolbarItem: ToolbarItem): Promise => {
switch (toolbarItem.props.name) {
case ToolbarItemName.DrawRectangle:
this.setState({
selectionMode: SelectionMode.RECT,
editorMode: EditorMode.Rectangle,
});
break;
case ToolbarItemName.DrawPolygon:
this.setState({
selectionMode: SelectionMode.POLYGON,
editorMode: EditorMode.Polygon,
});
break;
case ToolbarItemName.CopyRectangle:
this.setState({
selectionMode: SelectionMode.COPYRECT,
editorMode: EditorMode.CopyRect,
});
break;
case ToolbarItemName.SelectCanvas: