Commit 02c24bfe authored by Laura Fuentes Grau's avatar Laura Fuentes Grau

(edit-)lockAspect now works

parent 1be88936
......@@ -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}
......
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