2017-06-04 10:40:14 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-07-27 20:35:55 +08:00
|
|
|
import WhiteboardAnnotationModel from '../annotation-factory/component';
|
2017-02-23 08:10:30 +08:00
|
|
|
|
|
|
|
const propTypes = {
|
2017-07-27 20:35:55 +08:00
|
|
|
// initial width and height of the slide are required to calculate the coordinates for each annotation
|
2017-02-23 08:10:30 +08:00
|
|
|
width: PropTypes.number.isRequired,
|
|
|
|
height: PropTypes.number.isRequired,
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
// array of annotations, optional
|
|
|
|
annotations: PropTypes.array,
|
2017-02-23 08:10:30 +08:00
|
|
|
};
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
export default class AnnotationGroup extends React.Component {
|
2017-02-23 08:10:30 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
2017-07-27 20:35:55 +08:00
|
|
|
annotations,
|
2017-02-23 08:10:30 +08:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<g>
|
2017-07-27 20:35:55 +08:00
|
|
|
{annotations ? annotations.map(annotation =>
|
|
|
|
(<WhiteboardAnnotationModel
|
|
|
|
annotation={annotation}
|
|
|
|
key={annotation.id}
|
2017-06-03 03:25:02 +08:00
|
|
|
slideWidth={width}
|
|
|
|
slideHeight={height}
|
|
|
|
/>),
|
2017-02-23 08:10:30 +08:00
|
|
|
)
|
|
|
|
: null }
|
|
|
|
</g>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
AnnotationGroup.propTypes = propTypes;
|