Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Aug 29, 2023
1 parent 4669bcd commit 6499d35
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
6 changes: 3 additions & 3 deletions ui/src/actions/taskForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function showForm(
formName,
sampleQueueID = [],
taskData = {},
pointQueueID = -1,
pointQueueID = -1
) {
return {
type: 'SHOW_FORM',
Expand All @@ -17,7 +17,7 @@ export function showTaskForm(
formName,
sampleQueueID = -1,
taskData = {},
pointQueueID = -1,
pointQueueID = -1
) {
return function (dispatch) {
dispatch(showForm(formName, sampleQueueID, taskData, pointQueueID));
Expand All @@ -28,4 +28,4 @@ export function hideTaskParametersForm() {
return {
type: 'HIDE_FORM',
};
}
}
54 changes: 27 additions & 27 deletions ui/src/components/SampleView/SampleImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class SampleImage extends React.Component {
this.canvas = {};
this.drawGridPlugin = new DrawGridPlugin();
this.drawGridPlugin.setGridResultFormat(
process.env.REACT_APP_MESHRESULTFORMAT,
process.env.REACT_APP_MESHRESULTFORMAT
);
this._keyPressed = null;
this.gridStarted = false;
Expand Down Expand Up @@ -179,25 +179,25 @@ export default class SampleImage extends React.Component {
(options.e.layerX + 1.5) / this.props.imageRatio,
(options.e.layerY + 1) / this.props.imageRatio,
this.props.imageRatio,
this.canvas.height,
this.canvas.height
);

this.centringHorizontalLine = makeCentringHorizontalLine(
(options.e.layerX + 1.5) / this.props.imageRatio,
(options.e.layerY + 1) / this.props.imageRatio,
this.props.imageRatio,
this.canvas.width,
this.canvas.width
);

this.canvas.add(this.centringVerticalLine);
this.canvas.add(this.centringHorizontalLine);
}
if (options.e.buttons > 0 && this.drawGridPlugin.drawing) {

if (options.e.buttons > 0 && this.drawGridPlugin.drawing) {
this.drawGridPlugin.update(
this.canvas,
options.e.layerX,
options.e.layerY,
options.e.layerY
);
}

Expand Down Expand Up @@ -232,14 +232,14 @@ export default class SampleImage extends React.Component {
gridData,
true,
gridData.cellHSpace,
value,
value
);
this.props.sampleActions.sendUpdateShapes([gd]);
} else if (this.props.drawGrid) {
this.drawGridPlugin.setCurrentCellSpace(
null,
value,
this.props.imageRatio,
this.props.imageRatio
);
this.drawGridPlugin.repaint(this.canvas);
}
Expand All @@ -258,14 +258,14 @@ export default class SampleImage extends React.Component {
gridData,
true,
value,
gridData.cellVSpace,
gridData.cellVSpace
);
this.props.sampleActions.sendUpdateShapes([gd]);
} else if (this.props.drawGrid) {
this.drawGridPlugin.setCurrentCellSpace(
value,
null,
this.props.imageRatio,
this.props.imageRatio
);
this.drawGridPlugin.repaint(this.canvas);
}
Expand Down Expand Up @@ -351,7 +351,7 @@ export default class SampleImage extends React.Component {
}

this.props.selectedShapes.forEach((shapeID) =>
this.props.sampleActions.sendDeleteShape(shapeID),
this.props.sampleActions.sendDeleteShape(shapeID)
);
}

Expand Down Expand Up @@ -456,7 +456,7 @@ export default class SampleImage extends React.Component {
const gridData = this.props.grids[gridList[0]];
const cellCenter = this.getGridCellCenter(
group.getObjects()[0],
clickPoint,
clickPoint
);
ctxMenuObj = {
type: 'GridGroupSaved',
Expand Down Expand Up @@ -558,12 +558,12 @@ export default class SampleImage extends React.Component {
if (clickCentring) {
sampleActions.sendCentringPoint(
option.e.layerX / imageRatio,
option.e.layerY / imageRatio,
option.e.layerY / imageRatio
);
} else if (measureDistance) {
sampleActions.addDistancePoint(
option.e.layerX / imageRatio,
option.e.layerY / imageRatio,
option.e.layerY / imageRatio
);
} else if (this.props.drawGrid) {
this.drawGridPlugin.startDrawing(option, this.canvas, imageRatio);
Expand All @@ -573,13 +573,13 @@ export default class SampleImage extends React.Component {

const cellIdxX = parseInt(
Math.floor((option.pointer.x - option.target.oCoords.tl.x) / cellSizeX),
10,
10
);
const cellIdxY = parseInt(
Math.floor(
(option.pointer.y - option.target.oCoords.tl.y - 20) / cellSizeY,
(option.pointer.y - option.target.oCoords.tl.y - 20) / cellSizeY
),
10,
10
);

const shapeData = this.props.shapes[objectFound.id];
Expand All @@ -588,13 +588,13 @@ export default class SampleImage extends React.Component {
cellIdxY,
cellIdxX,
shapeData.numRows,
shapeData.numCols,
shapeData.numCols
);

const resultDataPath = shapeData.resultDataPath;
if (resultDataPath.length !== 0) {
this.props.generalActions.sendDisplayImage(
`${resultDataPath}&img_num=${imgNum}`,
`${resultDataPath}&img_num=${imgNum}`
);
}
}
Expand All @@ -617,27 +617,27 @@ export default class SampleImage extends React.Component {
// zoom in
sendMotorPosition(
'Phi',
phi.value + Number.parseInt(motorSteps.phiStep, 10),
phi.value + Number.parseInt(motorSteps.phiStep, 10)
);
} else if (e.deltaX < 0 || e.deltaY < 0) {
// zoom out
sendMotorPosition(
'Phi',
phi.value - Number.parseInt(motorSteps.phiStep, 10),
phi.value - Number.parseInt(motorSteps.phiStep, 10)
);
}
} else if (keyPressed === 'f' && focus.state === MOTOR_STATE.READY) {
if (e.deltaY > 0) {
// Focus in
sendMotorPosition(
'Focus',
focus.value + Number.parseFloat(motorSteps.focusStep, 10),
focus.value + Number.parseFloat(motorSteps.focusStep, 10)
);
} else if (e.deltaY < 0) {
// Focus out
sendMotorPosition(
'Focus',
focus.value - Number.parseFloat(motorSteps.focusStep, 10),
focus.value - Number.parseFloat(motorSteps.focusStep, 10)
);
}
} else if (keyPressed === 'z' && zoom.state === MOTOR_STATE.READY) {
Expand Down Expand Up @@ -767,7 +767,7 @@ export default class SampleImage extends React.Component {

saveGrid() {
const gd = this.drawGridPlugin.saveGrid(
this.drawGridPlugin.currentGridData(),
this.drawGridPlugin.currentGridData()
);
this.props.sampleActions.sendAddShape({ t: 'G', ...gd });
this.drawGridPlugin.reset();
Expand Down Expand Up @@ -877,8 +877,8 @@ export default class SampleImage extends React.Component {
beamSize,
clickCentring,
distancePoints,
this.canvas,
),
this.canvas
)
);

if (
Expand Down Expand Up @@ -909,7 +909,7 @@ export default class SampleImage extends React.Component {
gridData = this.drawGridPlugin.setPixelsPerMM(pixelsPerMm, gridData);
fabricSelectables.push(
this.drawGridPlugin.shapeFromGridData(gridData, this.canvas)
.shapeGroup,
.shapeGroup
);
}
});
Expand Down
7 changes: 2 additions & 5 deletions ui/src/containers/TaskContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import XRFScan from '../components/Tasks/XRFScan';
import EnergyScan from '../components/Tasks/EnergyScan';
import GenericTaskForm from '../components/Tasks/GenericTaskForm';

import {
hideTaskParametersForm,
showTaskForm,
} from '../actions/taskForm';
import { hideTaskParametersForm, showTaskForm } from '../actions/taskForm';

import {
addTask,
Expand Down Expand Up @@ -288,7 +285,7 @@ function mapDispatchToProps(dispatch) {
showTaskParametersForm: bindActionCreators(showTaskForm, dispatch),
hideTaskParametersForm: bindActionCreators(
hideTaskParametersForm,
dispatch,
dispatch
),
updateTask: bindActionCreators(updateTask, dispatch),
addTask: bindActionCreators(addTask, dispatch),
Expand Down

0 comments on commit 6499d35

Please sign in to comment.