mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
(edit-)lockAspect now works
This commit is contained in:
parent
1be889365e
commit
02c24bfecd
3 changed files with 6 additions and 6 deletions
|
@ -42,7 +42,7 @@ class Dashboard extends Component {
|
|||
|
||||
static lastWidgetKey = 0;
|
||||
static getStores() {
|
||||
return [ DashboardStore, LoginStore, WidgetStore, SignalStore, ConfigStore, ICStore];
|
||||
return [ DashboardStore, LoginStore,FileStore, WidgetStore, SignalStore, ConfigStore, ICStore];
|
||||
}
|
||||
|
||||
static calculateState(prevState, props) {
|
||||
|
@ -273,7 +273,6 @@ class Dashboard extends Component {
|
|||
};
|
||||
|
||||
uploadFile(data,widget){
|
||||
console.log("tschuuuu tschuuuu");
|
||||
AppDispatcher.dispatch({
|
||||
type: 'files/start-upload',
|
||||
data: data,
|
||||
|
|
|
@ -53,6 +53,7 @@ class EditWidgetDialog extends React.Component {
|
|||
}
|
||||
|
||||
assignAspectRatio(changeObject, fileId) {
|
||||
fileId = parseInt(fileId, 10)
|
||||
// get aspect ratio of file
|
||||
const file = this.props.files.find(element => element.id === fileId);
|
||||
|
||||
|
@ -113,9 +114,9 @@ class EditWidgetDialog extends React.Component {
|
|||
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 && this.state.temporal.customProperties.file) {
|
||||
if (e.target.checked && (this.state.temporal.customProperties.file !== -1)) {
|
||||
changeObject = this.assignAspectRatio(changeObject, this.state.temporal.customProperties.file);
|
||||
}
|
||||
} else if (e.target.id.includes('file')) {
|
||||
|
@ -123,7 +124,7 @@ class EditWidgetDialog extends React.Component {
|
|||
customProperty ? changeObject[parts[0]][parts[1]] = e.target.value : changeObject[e.target.id] = e.target.value;
|
||||
|
||||
// get file and update size (if it's an image)
|
||||
if ('lockAspect' in this.state.temporal && this.state.temporal.lockAspect) {
|
||||
if ((changeObject.customProperties.file !== -1)&&('lockAspect' in this.state.temporal && this.state.temporal.lockAspect)) {
|
||||
// TODO this if condition requires changes to work!!!
|
||||
changeObject = this.assignAspectRatio(changeObject, e.target.value);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class EditableWidgetContainer extends React.Component {
|
|||
minWidth={widget.minWidth}
|
||||
minHeight={widget.minHeight}
|
||||
maxWidth ={widget.customProperties.maxWidth || '100%' }
|
||||
lockAspectRatio={Boolean(widget.isLocked)}
|
||||
lockAspectRatio={Boolean(widget.customProperties.lockAspect)}
|
||||
bounds={'parent'}
|
||||
className={widgetClasses}
|
||||
onResizeStart={this.borderWasClicked}
|
||||
|
|
Loading…
Add table
Reference in a new issue