8000 refs retrieving fix · Pull Request #7 · dominictobias/react-image-crop · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refs retrieving fix #7

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
24 changes: 12 additions & 12 deletions dist/ReactCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ var ReactCrop = _react2['default'].createClass({
var clientPos = this.getClientPos(e);

// Focus for detecting keypress.
this.refs.component.focus();
this.refs.component.getDOMNode().focus();

var ord = e.target.dataset.ord;
var xInversed = ord === 'nw' || ord === 'w' || ord === 'sw';
Expand All @@ -320,12 +320,12 @@ var ReactCrop = _react2['default'].createClass({
var cropOffset = undefined;

if (crop.aspect) {
cropOffset = this.getElementOffset(this.refs.cropSelect);
cropOffset = this.getElementOffset(this.refs.cropSelect.getDOMNode());
}

this.evData = {
imageWidth: this.refs.image.width,
imageHeight: this.refs.image.height,
imageWidth: this.refs.image.getDOMNode().width,
imageHeight: this.refs.image.getDOMNode().height,
clientStartX: clientPos.x,
clientStartY: clientPos.y,
cropStartWidth: crop.width,
Expand All @@ -338,7 +338,7 @@ var ReactCrop = _react2['default'].createClass({
yCrossOver: yInversed,
startXCrossOver: xInversed,
startYCrossOver: yInversed,
isResize: e.target !== this.refs.cropSelect,
isResize: e.target !== this.refs.cropSelect.getDOMNode(),
ord: ord,
cropOffset: cropOffset
};
Expand All @@ -365,7 +365,7 @@ var ReactCrop = _react2['default'].createClass({
},

onComponentMouseTouchDown: function onComponentMouseTouchDown(e) {
if (e.target !== this.refs.imageCopy) {
if (e.target !== this.refs.imageCopy.getDOMNode()) {
return;
}

Expand All @@ -375,20 +375,20 @@ var ReactCrop = _react2['default'].createClass({
var clientPos = this.getClientPos(e);

// Focus for detecting keypress.
this.refs.component.focus();
this.refs.component.getDOMNode().focus();

var imageOffset = this.getElementOffset(this.refs.image);
var xPc = (clientPos.x - imageOffset.left) / this.refs.image.width * 100;
var yPc = (clientPos.y - imageOffset.top) / this.refs.image.height * 100;
var imageOffset = this.getElementOffset(this.refs.image.getDOMNode());
var xPc = (clientPos.x - imageOffset.left) / this.refs.image.getDOMNode().width * 100;
var yPc = (clientPos.y - imageOffset.top) / this.refs.image.getDOMNode().height * 100;

crop.x = xPc;
crop.y = yPc;
crop.width = 0;
crop.height = 0;

this.evData = {
imageWidth: this.refs.image.width,
imageHeight: this.refs.image.height,
imageWidth: this.refs.image.getDOMNode().width,
imageHeight: this.refs.image.getDOMNode().height,
clientStartX: clientPos.x,
clientStartY: clientPos.y,
cropStartWidth: crop.width,
Expand Down
24 changes: 12 additions & 12 deletions lib/ReactCrop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ var ReactCrop = React.createClass({
let clientPos = this.getClientPos(e);

// Focus for detecting keypress.
this.refs.component.focus();
this.refs.component.getDOMNode().focus();

let ord = e.target.dataset.ord;
let xInversed = ord === 'nw' || ord === 'w' || ord === 'sw';
Expand All @@ -318,12 +318,12 @@ var ReactCrop = React.createClass({
let cropOffset;

if (crop.aspect) {
cropOffset = this.getElementOffset(this.refs.cropSelect);
cropOffset = this.getElementOffset(this.refs.cropSelect.getDOMNode());
}

this.evData = {
imageWidth: this.refs.image.width,
imageHeight: this.refs.image.height,
imageWidth: this.refs.image.getDOMNode().width,
imageHeight: this.refs.image.getDOMNode().height,
clientStartX: clientPos.x,
clientStartY: clientPos.y,
cropStartWidth: crop.width,
Expand All @@ -336,7 +336,7 @@ var ReactCrop = React.createClass({
yCrossOver: yInversed,
startXCrossOver: xInversed,
startYCrossOver: yInversed,
isResize: e.target !== this.refs.cropSelect,
isResize: e.target !== this.refs.cropSelect.getDOMNode(),
ord: ord,
cropOffset: cropOffset
};
Expand All @@ -362,7 +362,7 @@ var ReactCrop = React.createClass({
},

onComponentMouseTouchDown(e) {
if (e.target !== this.refs.imageCopy) {
if (e.target !== this.refs.imageCopy.getDOMNode()) {
return;
}

Expand All @@ -372,20 +372,20 @@ var ReactCrop = React.createClass({
let clientPos = this.getClientPos(e);

// Focus for detecting keypress.
this.refs.component.focus();
this.refs.component.getDOMNode().focus();

let imageOffset = this.getElementOffset(this.refs.image);
let xPc = (clientPos.x - imageOffset.left) / this.refs.image.width * 100;
let yPc = (clientPos.y - imageOffset.top) / this.refs.image.height * 100;
let imageOffset = this.getElementOffset(this.refs.image.getDOMNode());
let xPc = (clientPos.x - imageOffset.left) / this.refs.image.getDOMNode().width * 100;
let yPc = (clientPos.y - imageOffset.top) / this.refs.image.getDOMNode().height * 100;

crop.x = xPc;
crop.y = yPc;
crop.width = 0;
crop.height = 0;

this.evData = {
imageWidth: this.refs.image.width,
imageHeight: this.refs.image.height,
imageWidth: this.refs.image.getDOMNode().width,
imageHeight: this.refs.image.getDOMNode().height,
clientStartX: clientPos.x,
clientStartY: clientPos.y,
cropStartWidth: crop.width,
Expand Down
0