render: cropper & download image

This commit is contained in:
muerwre 2018-11-28 17:57:56 +07:00
parent 857a2a0c12
commit 34d1b85513
14 changed files with 308 additions and 40 deletions

View file

@ -9,10 +9,8 @@ import { EditorDialog } from '$components/panels/EditorDialog';
import { LogoPreview } from '$components/logo/LogoPreview';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { setMode, startEditing, stopEditing, setLogo, showRenderer } from '$redux/user/actions';
import { setMode, startEditing, stopEditing, setLogo, takeAShot } from '$redux/user/actions';
import type { UserType } from '$constants/types';
import { editor } from '$modules/Editor';
import { getTilePlacement } from '$utils/renderer';
type Props = {
user: UserType,
@ -31,7 +29,7 @@ type Props = {
startEditing: Function,
stopEditing: Function,
setLogo: Function,
showRenderer: Function,
takeAShot: Function,
}
class Component extends React.PureComponent<Props, void> {
@ -39,8 +37,6 @@ class Component extends React.PureComponent<Props, void> {
const obj = document.getElementById('control-dialog');
const { width } = this.panel.getBoundingClientRect();
console.log(obj, this.panel);
if (!this.panel || !obj) return;
obj.style.width = width;
@ -109,7 +105,7 @@ class Component extends React.PureComponent<Props, void> {
<button
className={classnames('disabled', { active: mode === MODES.SHOTTER })}
onClick={this.props.showRenderer}
onClick={this.props.takeAShot}
// onClick={getTilePlacement}
>
<Icon icon="icon-shot-3" />
@ -221,7 +217,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({
setLogo,
startEditing,
stopEditing,
showRenderer,
takeAShot,
}, dispatch);
export const EditorPanel = connect(