Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update repo to support React 16 #19 #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mkozhukharenko
Copy link

No description provided.

@mkozhukharenko mkozhukharenko changed the title Update repo to support React 16 Update repo to support React 16 #19 Nov 1, 2017
let Wrapper = React.createClass({
displayName: 'Wrapper',
class Wrapper extends React.Component {
displayName = 'Wrapper'
Copy link

@isnifer isnifer Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static displayName = 'Wrapper'

image: null,
previewUrl: null
}
},
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state = {
  image: null,
  previewUrl: null
}


controlsResize (event) {
controlsResize = (event) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controlsResize = ({ target: { name, value } }) => {


controlsResize (event) {
controlsResize = (event) => {
let box = this.refs.box.parentElement.parentElement.getBoundingClientRect()
let width = event.target.name === 'width' ? +event.target.value : +event.target.value * this.props.aspectRatio
Copy link

@isnifer isnifer Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const rawWidth = name === 'width' ? +value : +value * this.props.aspectRatio


controlsResize (event) {
controlsResize = (event) => {
let box = this.refs.box.parentElement.parentElement.getBoundingClientRect()
let width = event.target.name === 'width' ? +event.target.value : +event.target.value * this.props.aspectRatio
let height = event.target.name === 'height' ? +event.target.value : +event.target.value / this.props.aspectRatio
Copy link

@isnifer isnifer Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const rawHeight = name === 'height' ? +value : +value / this.props.aspectRatio
const [width, height] = this.preserveAspectRatio(rawWidth, rawHeight)

let movedX = evt.target.name === 'x' ? evt.target.value - this.state.left : 0
let movedY = evt.target.name === 'y' ? evt.target.value - this.state.top : 0
this.moveBox(0, 0, movedX, movedY)
},
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controlsMoveBox = ({ target: { name, value } }) => {
  const movedX = name === 'x' ? value - this.state.left : 0
  const movedY = name === 'y' ? value - this.state.top : 0
  this.moveBox(0, 0, movedX, movedY)
}

export default React.createClass({
displayName: 'Cropper',
export default class extends React.Component {
displayName = 'Cropper'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static displayName = 'Cropper'

onImageLoaded: React.PropTypes.func,
minConstraints: React.PropTypes.arrayOf(React.PropTypes.number)
},
propTypes = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static propTypes = {

offsetYLabel: 'Offset Y'
}
},
defaultProps = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static defaultProps = {

imageLoaded: false,
width: this.props.width,
height: this.props.height,
url: window.URL.createObjectURL(this.props.image)
}
},
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state = {
  imageLoaded: false,
  width: this.props.width,
  height: this.props.height,
  url: window.URL.createObjectURL(this.props.image)
}


cropImage () {
cropImage = () => {
return new Promise((resolve, reject) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return new Promise((resolve) => {

@isnifer
Copy link

isnifer commented Dec 18, 2017

@mkozhukharenko your turn

@shichongrui shichongrui mentioned this pull request May 24, 2018
@shichongrui
Copy link

@mkozhukharenko any desire to push this through or can this be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants