mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-16 00:00:03 +01:00
Image widget : fix for lockAspect edit option
This commit is contained in:
parent
ea42510f39
commit
78e13798f9
1 changed files with 5 additions and 3 deletions
|
@ -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')) {
|
||||
|
|
Loading…
Add table
Reference in a new issue