﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
10051	Image dialog - ratio lock is quantised	Gael		"The ratio lock is quantised, making the lock to unexpectedly unlock.

1. Insert a 4000x3000 px image in CKEditor.
2. Right click on the image and open the image dialiog.
3. Ensure the ratio lock is lock, then change its width to: 330. The height automatically change to 248.
4. Save, re-open the image dialog. The width / height are still 330x248, but the ratio lock is unlock even if the values respect the image ratio.

The calculated ratios are not equals:[[BR]]
originalRatio: 1333 (accurate)[[BR]]
thisRatio: 1330 (quantised)

I think the logic in switchLockRatio method is wrong. Instead of comparing the ratio, where one has been quantised to pixels, it would make more sense to re-calculate the height and check if the image height equals the calculated one.

The following code replacement fix this issue:

File: _source/plugins/image/dialogs/image.js[[BR]]
Lines: 132 to 144
{{{
var width = dialog.getValueOf( 'info', 'txtWidth' ),
	height = dialog.getValueOf( 'info', 'txtHeight' ),
	originalRatio = oImageOriginal.$.width / oImageOriginal.$.height;
dialog.lockRatio = false; // Default: unlock ratio

if (!width && !height) {
	dialog.lockRatio = true;
} else {
	if (!isNaN(originalRatio)) {
		var ratioHeight = Math.round(width / originalRatio);
		if (ratioHeight == height) {
			dialog.lockRatio = true;
		}
	}
}
}}}"	Bug	confirmed	Normal		UI : Dialogs	3.0			
