diff --git a/app.jsx b/app.jsx index a954a12..7140a2f 100644 --- a/app.jsx +++ b/app.jsx @@ -6,12 +6,14 @@ Window = React.createClass({ images = { boxFront: params.imageBoxFront, boxBack: params.imageBoxBack, - boxSide: params.imageBoxSide, + boxSideLeft: params.imageBoxSideLeft, + boxSideRight: params.imageBoxSideRight, boxTop: params.imageBoxTop }; return makeBox(params.paper, params.height, params.width, params.depth, - params.inside, params.color, params.title, images); + params.inside, params.color, params.title, images, + params.mirrorBoxTopOnBottom); }, generatePreview: function(params) { this.setState({pdfBlob: this.generatePdf(params).buildPdfUriString()}); @@ -64,8 +66,10 @@ Configurator = React.createClass({ title: this.state.title, imageBoxFront: this.state.imageBoxFront, imageBoxBack: this.state.imageBoxBack, - imageBoxSide: this.state.imageBoxSide, - imageBoxTop: this.state.imageBoxTop + imageBoxSideLeft: this.state.imageBoxSideLeft, + imageBoxSideRight: this.state.imageBoxSideRight, + imageBoxTop: this.state.imageBoxTop, + mirrorBoxTopOnBottom: this.state.mirrorBoxTopOnBottom }; var hasInvalid = false; props.forEach(function(prop) { @@ -169,18 +173,32 @@ Configurator = React.createClass({ this.changeState('imageBoxFront', null); } }, - imageBoxSideChange: function(e) { + imageBoxSideLeftChange: function(e) { if (e.target.files) { var file = e.target.files[0]; var reader = new FileReader(); var _this = this; reader.onload = function(e) { var datauri = e.target.result; - _this.changeState('imageBoxSide', datauri); + _this.changeState('imageBoxSideLeft', datauri); }; reader.readAsDataURL(file); } else { - this.changeState('imageBoxSide', null); + this.changeState('imageBoxSideLeft', null); + } + }, + imageBoxSideRightChange: function(e) { + if (e.target.files) { + var file = e.target.files[0]; + var reader = new FileReader(); + var _this = this; + reader.onload = function(e) { + var datauri = e.target.result; + _this.changeState('imageBoxSideRight', datauri); + }; + reader.readAsDataURL(file); + } else { + this.changeState('imageBoxSideRight', null); } }, imageBoxTopChange: function(e) { @@ -197,6 +215,9 @@ Configurator = React.createClass({ this.changeState('imageBoxTop', null); } }, + mirrorBoxTopOnBottomChange: function(e) { + this.changeState('mirrorBoxTopOnBottom', e.target.checked); + }, render: function() { return (