-
Notifications
You must be signed in to change notification settings - Fork 24
Update repo to support React 16 #19 #23
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
base: master
Are you sure you want to change the base?
Conversation
let Wrapper = React.createClass({ | ||
displayName: 'Wrapper', | ||
class Wrapper extends React.Component { | ||
displayName = 'Wrapper' |
There was a problem hiding this comment.
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 | ||
} | ||
}, | ||
} |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) | ||
}, | ||
} |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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) | ||
} | ||
}, | ||
} |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new Promise((resolve) => {
@mkozhukharenko your turn |
@mkozhukharenko any desire to push this through or can this be closed? |
No description provided.