Commit 78e13798 authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

Image widget : fix for lockAspect edit option

parent ea42510f
......@@ -57,8 +57,10 @@ class EditWidgetDialog extends React.Component {
const file = this.props.files.find(element => element.id === fileId);
// scale width to match aspect
if(file.dimensions){
const aspectRatio = file.dimensions.width / file.dimensions.height;
changeObject.width = this.state.temporal.height * aspectRatio;
}
return changeObject;
}
......@@ -73,13 +75,13 @@ class EditWidgetDialog extends React.Component {
// not a customProperty
customProperty = false;
}
if (e.target.id === 'lockAspect') {
if (parts[1] === 'lockAspect') {
//not a customProperty
customProperty ? changeObject[parts[0]][parts[1]] = e.target.checked : changeObject[e.target.id] = e.target.checked;
// correct image aspect if turned on
if (e.target.checked) {
if (e.target.checked && this.state.temporal.customProperties.file) {
changeObject = this.assignAspectRatio(changeObject, this.state.temporal.customProperties.file);
}
} else if (e.target.id.includes('file')) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment