Skip to content

Update repo to support React 16 #19#23

Open
mkozhukharenko wants to merge 4 commits intoinstructure-react:masterfrom
mkozhukharenko:master
Open

Update repo to support React 16 #19#23
mkozhukharenko wants to merge 4 commits intoinstructure-react:masterfrom
mkozhukharenko:master

Conversation

@mkozhukharenko
Copy link
Copy Markdown

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
Copy Markdown

@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'

previewUrl: null
}
},
}
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

@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) => {
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
Copy Markdown

@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 movedY = evt.target.name === 'y' ? evt.target.value - this.state.top : 0
this.moveBox(0, 0, movedX, movedY)
},
}
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

Choose a reason for hiding this comment

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

static defaultProps = {

url: window.URL.createObjectURL(this.props.image)
}
},
}
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

isnifer commented Dec 18, 2017

@mkozhukharenko your turn

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

@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.

3 participants