Sounds good and should be simple to implement. Thanks for the suggestion!
Thread Starter
alkafy
(@alkafy)
I’m sure you could do this more elegantly, but I hacked together a solution:
Line 768 scissors.php
$resizeValue = "<input style='width:3em;text-align:center;' type='text' id='scissorsSide-$postId' value='640' onkeyup=\"scissorsCalcResize($postId)\" />";
New Function in scissors.js
function scissorsCalcResize(id) {
var resizeDim = Number(jQuery(‘#scissorsSide-‘+id).val());
var dimensions = jQuery(‘#scissorsSize-‘+id).html().split(‘ × ‘);
var width = Number(dimensions[0]);
var height = Number(dimensions[1]);
var resizeMode = jQuery(‘#scissorsMode-‘+id).val();
if (resizeMode!=’width’ && resizeMode!=’height’) {
var longSide = ‘width’;
var shortSide = ‘height’;
if (width<height) {
longSide = ‘height’;
shortSide = ‘width’;
}
if (resizeMode==’long’) {
resizeMode = longSide;
}else {
resizeMode = shortSide;
}
}
if (resizeMode==’width’) {
height = Math.floor((resizeDim/width)*height);
width = resizeDim;
} else {
width = Math.floor((resizeDim/height)*width);
height = resizeDim;
}
if (jQuery(‘#newSizes-‘+id).length==0) {
jQuery(‘#scissorsSize-‘+id).after(‘<span id=”newSizes-‘+id+'”></span>’);
}
jQuery(‘#newSizes-‘+id).html(‘ Calculated Size: ‘+width+’ x ‘+height);
}
Implemented and part of the new development version (find it under ‘other versions’). Please test it and if you’re satisfied mark this thread as resolved. Thanks!
Thread Starter
alkafy
(@alkafy)
Nicely done. Thank you very much.