Hi, I am having a problem with the jcrop selector when I rotate my jcropped image. When the image is rotated using css, my jcrop selector moves the other way around. I believe this is because jcrop does not understand that it rotates, and the selector moves in accordance with the original image size.
Is there a way to show jcrop that the image is rotated?
Btw I use the angularjs directive to implement jcrop (this is angularjsapp). Thanks
directive.js
.directive('imgCropped', function() {
return {
restrict: 'E',
replace: true,
scope: {src: '@', selected: '&'},
link: function(scope, element, attr) {
var myImg;
var clear = function() {
if (myImg) {
myImg.next().remove();
myImg.remove();
myImg = undefined;
}
};
scope.$watch('src', function(nv) {
clear();
if (nv) {
element.after('<img degrees="angle" rotate/>');
myImg = element.next();
myImg.attr('src', nv);
$(myImg).Jcrop({
trackDocument: true,
onSelect: function(x) {
scope.selected({cords: x});
},
keySupport: false,
aspectRatio: 1,
boxWidth: 400, boxHeight: 400,
setSelect: [0, 0, 400, 400]
}, function(){
jcrop_api = this;
});
}
});
scope.$on('$destroy', clear);
}
};
})
source
share