minor fixes to the image crop experiemnt...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-01-17 03:09:22 +03:00
parent 0888315038
commit 81e375d1cc
2 changed files with 20 additions and 4 deletions

View File

@ -513,13 +513,14 @@ $(DIST_DIR)/$(APP_NAME)-%.msi: $(BUILD_DIR)/$(APP_NAME)-% $(BUILD_DIR)/$(APP_NAM
#----------------------------------------------------------------------
# Debian package...
# deb/rpm package...
# XXX
#----------------------------------------------------------------------
# Mobile (cordova/PhoneGap) XXX
# Mobile (cordova/PhoneGap)...
# XXX

View File

@ -101,7 +101,11 @@ $(function(){
function setRatio(ratio){
var crop = $('.crop')
crop
.resizable("option", "aspectRatio", ratio)
// XXX this feels like a hack but it works...
.data('uiResizable')._aspectRatio = ratio
if(ratio === false){
return
@ -122,8 +126,19 @@ function setRatio(ratio){
function flip(){
var crop = $('.crop')
var r = crop.resizable("option", "aspectRatio")
r > 0
&& setRatio(1/r)
if(r > 0){
setRatio(1/r)
// no aspect ratio defined, just switch...
} else {
var w = crop.width()
var h = crop.height()
crop
.height(w)
.width(h)
}
}
</script>