Select Git revision
test_amrbatch_main.py
AnnotationDrawing.js 11.64 KiB
import React, { Component, useState } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { OSDReferences } from '../mirador/dist/es/src/plugins/OSDReferences';
import { VideosReferences } from '../mirador/dist/es/src/plugins/VideosReferences';
import { v4 as uuidv4 } from 'uuid';
import {
Stage, Layer, Star, Text, Circle, Rect
, Ellipse, Transformer,
} from 'react-konva';
class TextNode extends React.Component {
constructor(props) {
super(props);
this.shapeRef = React.createRef();
this.trRef = React.createRef();
}
handleClick = () => {
this.props.onShapeClick(this.props.id);
};
componentDidMount() {
if (this.trRef.current) {
this.trRef.current.nodes([this.shapeRef.current]);
this.trRef.current.getLayer().batchDraw();
}
}
render() {
const { activeTool } = this.props;
console.log("selectedId", this.props.selectedShapeId);
const isSelected = this.props.id === this.props.selectedShapeId;
return (
<React.Fragment>
<Text
ref={this.shapeRef}
x={this.props.x}
y={this.props.y}
fontSize={this.props.fontSize}
fill={this.props.fill}
text={this.props.text}
//dragable if tool is cursor or edit
draggable={activeTool === 'cursor' || activeTool === 'edit'}
onClick={this.handleClick}
// onClick={activeTool === 'cursor' ? null : null}
// onDblClick={acveTool === 'edit' ? this.handleClick : null}ti
/>
<Transformer ref={this.trRef}