2016-05-27 08:03:30 +08:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-05-27 08:13:53 +08:00
|
|
|
import WhiteboardShapeModel from './shape-factory/component.jsx';
|
2016-05-27 08:03:30 +08:00
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
2016-05-27 08:13:53 +08:00
|
|
|
import Slide from './slide/component.jsx';
|
|
|
|
import styles from './styles.scss';
|
2016-05-31 02:12:02 +08:00
|
|
|
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
|
2016-05-27 08:03:30 +08:00
|
|
|
|
|
|
|
export default class Whiteboard extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2016-05-31 02:12:02 +08:00
|
|
|
|
|
|
|
<div
|
|
|
|
id="whiteboard-paper"
|
|
|
|
style={this.props.svgStyle}
|
|
|
|
className={styles.whiteboard}
|
|
|
|
>
|
2016-05-27 08:03:30 +08:00
|
|
|
<div id="svggroup">
|
2016-05-31 02:12:02 +08:00
|
|
|
{ this.props.current_slide ?
|
|
|
|
<ReactCSSTransitionGroup
|
|
|
|
transitionName={ {
|
|
|
|
enter: styles.enter,
|
|
|
|
enterActive: styles.enterActive,
|
|
|
|
appear: styles.appear,
|
|
|
|
appearActive: styles.appearActive
|
|
|
|
} }
|
|
|
|
transitionAppear={true}
|
|
|
|
transitionEnter={true}
|
|
|
|
transitionLeave={false}
|
|
|
|
transitionAppearTimeout={400}
|
|
|
|
transitionEnterTimeout={400}
|
|
|
|
transitionLeaveTimeout={400}
|
|
|
|
>
|
|
|
|
<svg
|
|
|
|
{...this.props.svgProps}
|
|
|
|
version="1.1"
|
|
|
|
xmlNS="http://www.w3.org/2000/svg"
|
|
|
|
style={this.props.svgStyle}
|
|
|
|
key={this.props.current_slide.slide.id}
|
|
|
|
>
|
|
|
|
<Slide current_slide={this.props.current_slide} />
|
|
|
|
{ this.props.shapes ? this.props.shapes.map((shape) =>
|
|
|
|
<WhiteboardShapeModel
|
|
|
|
shape={shape}
|
|
|
|
key={shape.shape.id}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
: null }
|
|
|
|
</svg>
|
|
|
|
</ReactCSSTransitionGroup>
|
|
|
|
: null }
|
2016-05-27 08:03:30 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Whiteboard.defaultProps = {
|
|
|
|
svgProps: {
|
|
|
|
width:'1134',
|
|
|
|
height:'850.5',
|
|
|
|
preserveAspectRatio: 'xMinYMin slice',
|
|
|
|
viewBox:'0 0 1134 850.5',
|
|
|
|
},
|
|
|
|
svgStyle: {
|
|
|
|
overflow: 'hidden',
|
|
|
|
position: 'relative',
|
|
|
|
},
|
|
|
|
};
|