fixes: U4-8769 ImageCropper focal points randomly sets to 'null'

This commit is contained in:
Mads Rasmussen
2016-10-17 13:32:09 +02:00
parent 900f8970f0
commit e4a472f902
2 changed files with 9 additions and 3 deletions

View File

@@ -118,9 +118,13 @@ angular.module("umbraco.directives")
$timeout(function(){
setDimensions();
});
var offsetX = $overlay[0].offsetLeft;
var offsetY = $overlay[0].offsetTop;
calculateGravity(offsetX, offsetY);
// Make sure we can find the offset values for the overlay(dot) before calculating
// fixes issue with resize event when printing the page (ex. hitting ctrl+p inside the rte)
if($overlay.is(':visible')) {
var offsetX = $overlay[0].offsetLeft;
var offsetY = $overlay[0].offsetTop;
calculateGravity(offsetX, offsetY);
}
});
});

View File

@@ -20,6 +20,8 @@ angular.module("umbraco.directives")
var curr = $(event.target); // active tab
var prev = $(event.relatedTarget); // previous tab
$scope.$apply();
for (var c in callbacks) {
callbacks[c].apply(this, [{current: curr, previous: prev}]);
}